before _Objects_Open
    Joel Sherrill 
    joel.sherrill at oarcorp.com
       
    Fri Apr  6 11:19:20 UTC 2007
    
    
  
吴昊 wrote:
> Joel Sherrill 写道:
>> 吴昊 wrote:
>>> Hi:
>>> I am reading source code of rtems-4.0.0.Here i got a problem:
>>> Before "_Objects_Open()",why _Thread_Disable_dispatch() is called?(e.g.
>>> in function"rtems_semaphore_create",the comment is " /* prevents
>>> deletion */"
>>>   
>> It prevents any context switches from occurring which effectively 
>> prevents
>> the deletion of the thread doing the create operation.  Between 
>> pulling the
>> semaphore structure off the inactive list and publishing it via 
>> _Objects_Open,
>> you don't want to get deleted since that would lose the object instance.
>>
>> --joel
>  In what case the other thread will delete the object which is being 
> created,since
>  the object id has not been returned yet?
Right you can't delete the object being created but you can delete the 
thread
calling object create.  This is the case we are worried about.
T1:  semaphore create
T2: delete T1
If the delete of T1 happens in the middle of semaphore create, then the
semaphore is neither in the inactive list nor allocated -- it is just lost.
--joel
>>> Have fun!
>>>
>>> Hao Wu
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.com
>>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>>   
>>
>
    
    
More information about the users
mailing list