An apparatus, program product and method support the deallocation of a
data structure in a multithreaded computer without requiring the use of
computationally expensive semaphores or spin locks. Specifically, access
to a data structure is governed by a shared pointer that, when a request
is received to deallocate the data structure, is initially set to a value
that indicates to any thread that later accesses the pointer that the
data structure is not available. In addition, to address any thread that
already holds a copy of the shared pointer, and thus is capable of
accessing the data structure via the shared pointer after the initiation
of the request, all such threads are monitored to determine whether any
thread is still using the shared pointer by determining whether any
thread is executing program code that is capable of using the shared
pointer to access the data structure. Once this condition is met, it is
ensured that no thread can potentially access the data structure via the
shared pointer, and as such, the data structure may then be deallocated.