http://relacy.pastebin.com/f16a30da2
is a limited variation on the algorithm I previously presented here:
http://webpages.charter.net/appcore/misc/pc_sample_h_v1.html
The main difference is that it uses normal word-based atomic operations and
allocates collector objects from a bounded queue which enforces empty/full
conditions with eventcounts. Therefore, there is a bounded number of
deferred objects. 0xFFFF objects is the high-watermark for a 32-bit system
wrt to this particular implementation. Of course you could use a smaller
reference count and a higher deferment limit if you so choose. One can also
combine this with the following usage pattern:
http://groups.google.com/group/comp.programming.threads/msg/3796240ba6eeaa1c
in order to efficiently reuse nodes, and take pressure of the deferment
mechanism.