Thomas Munro <thomas.mu...@enterprisedb.com> writes: > Could we install the sentinel and pop the first entry at the same > time, so that we're not adding an extra spinlock acquire/release?
Hm, maybe. Other ideas in that space: * if queue is empty when we first acquire the spinlock, we don't have to do anything at all. * if queue is empty after we pop the first entry, we needn't bother installing our sentinel, just signal that proc and we're done. It's a question of how complicated you're willing to make this logic, and whether you trust that we'll be able to test all the code paths. regards, tom lane