nicowilliams/heimdal — comment on commit 6fce54a5b1f68e3fb6007bb17da5038bb7eb8489
File: base/db.c line 126
By nicowilliams:

Well, if you look at this commit: 004464607a9029ae3a01e07ca63c66007861eb01 (in my pgss branch) you'll see that there's a nice, portable, BSD-licensed library of atomic operations (on many CPUs, OSes, and with many compilers) including: increment, decrement, test-and-set, CAS, and memory barriers. As long as we use things like heim_once() and that maps to pthread_once() or W32 equivalent, we're OK for this sort of thing. I really don't see what's wrong with the above code, except that it'd be nice to have a nice memory model in C -- but we don't.