[RFC] sysctl locking
Don Lewis
truckman at FreeBSD.org
Thu Oct 14 23:14:43 PDT 2004
On 13 Oct, Suleiman Souhlal wrote:
>> What happens if:
>> thread A owns an oid
>>
>> thread B, which wants to delete the oid, goes to sleep to wait
>> for the oid
>>
>> thread C wants the oid and goes to sleep
>>
>> thread A releases the oid and wakes up thread B
>>
>> thread B deletes the oid
>>
>> thread C does ???
>
> I didn't think of this possibility. I guess I'll have to rethink the
> whole thing, whenever I find some time.
Have thread B mark the oid as deleted and disconnect it from the tree.
When any subsequent waiting threads gain ownership, have them return
ENOENT if they see the deleted flag instead of calling the handler.
Free the oid when the last waiting thread gives up ownership.
More information about the freebsd-arch
mailing list