On 1/28/08, David Clark <vdc1048 at tx.rr.com> wrote: > Ok got an idea here. It has to do with lock_count which associated > with the lock. > > enter_lock(): > increments lock count > tries to get the OS lock. > > leave_lock(): > decrements lock count > releases the OS lock. > if lock_count==0 and marked for deletion // was intended to be > deleted elsewhere do it now. > delete lock. > Doesn't the code above potentially have problem, as it checks for lock_count and performs deletion without acquiring the mutex? cheers, -benny > destory_lock(): > if lock_count==0 // we can delete now > remove lock from memory > set pointer to zero. > else > mark lock for deletion. // we can delete somewhere else. > > > >cheers, > > -benny