"Once" one-time concurrent initialization with an integer (nullprogram.com)
from tedu@azorius.net to programming@azorius.net on 01 Aug 2023 03:51
https://azorius.net/p/b77r8v7KH7dxWP737p-Once-onetime-concurrent-initialization-with-an-i

We’ve previously discussed integer barriers, integer queues, and integer wait groups as tiny concurrency utilities. Next let’s tackle “once” initialization, i.e. pthread_once, using an integer. We’ll need only three basic atomic operations — store, load, and increment — and futex wait/wake. It will be zero-initialized and the entire source small enough to fit on an old-fashioned terminal display. The interface will also get an overhaul, more to my own tastes.

#programming

threaded - newest