On 11/09/2010 10:06 PM, Vladislav Bolkhovitin wrote:
Totally theoretically speaking, since I have not inspected the code.
If today you wait for the count to reach zero, then unregister
and send an event to some other subsystem to free the object.
Is it not the same as if you take an extra refcount, unregister and
send the event at count=1. Then at that other place decrement the last
count to cause the object to be freed.
I agree that it is hard to do lockless. what some places do is have
an extra kref. The kobj has a single ref on it. everything takes the
other kref. when that reaches zero the unregister and event fires
and at free you decrement the only kobj ref to deallocate. This is one
way. In some situations you can manage with a single counter it all
depends.
Boaz
--