On Tue, May 22, 2012 at 11:36 PM, Ants Aasma <a...@cybertec.at> wrote: > ... The free list > itself is a bit trickier, but if it's still necessary/useful then > SC->firstFreeBuffer and buf->freeNext are in effect a linked-list > stack, there should plenty of tested lock free algorithms floating > around for that. (btw. lastFreeBuffer looks like dead code, is that > correct?)
Thinking about it a bit more, if the freelist is mostly empty, a simpler alternative would be to make an unprotected read to check SC->firstFreeBuffer and only acquire BufFreelistLock if there's anything to pop. This would reduce the lock free parts to just atomically incrementing a variable. Ants Aasma -- Cybertec Schönig & Schönig GmbH Gröhrmühlgasse 26 A-2700 Wiener Neustadt Web: http://www.postgresql-support.de -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers