[Threading] A couple of header file fixes.

Some declarations were missing from non-Darwin sources, and the Linux
header was slightly broken.

rdar://90776105
This commit is contained in:
Alastair Houghton
2022-04-20 17:51:19 +01:00
parent 1243d155b5
commit 2398fe76f6
3 changed files with 6 additions and 2 deletions

View File

@@ -130,11 +130,11 @@ struct once_t {
linux::ulock_t lock;
};
using once_t = std::atomic<int>;
void once_slow(once_t &predicate, void (*fn)(void *), void *context);
inline void once(once_t &predicate, void (*fn)(void *), void *context) {
// Sadly we can't use ::pthread_once() for this (no context)
if (predicate.load(std::memory_order_acquire) < 0)
if (predicate.flag.load(std::memory_order_acquire) < 0)
return;
once_slow(predicate, fn, context);