atomicops.h
Go to the documentation of this file.
1 // ©2013-2016 Cameron Desrochers.
2 // Distributed under the simplified BSD license (see the license file that
3 // should have come with this header).
4 // Uses Jeff Preshing's semaphore implementation (under the terms of its
5 // separate zlib license, embedded below).
6 
7 #pragma once
8 
9 // Provides portable (VC++2010+, Intel ICC 13, GCC 4.7+, and anything C++11 compliant) implementation
10 // of low-level memory barriers, plus a few semi-portable utility macros (for inlining and alignment).
11 // Also has a basic atomic type (limited to hardware-supported atomics with no memory ordering guarantees).
12 // Uses the AE_* prefix for macros (historical reasons), and the "moodycamel" namespace for symbols.
13 
14 #include <cerrno>
15 #include <cassert>
16 #include <type_traits>
17 #include <cerrno>
18 #include <cstdint>
19 #include <ctime>
20 
21 // Platform detection
22 #if defined(__INTEL_COMPILER)
23 #define AE_ICC
24 #elif defined(_MSC_VER)
25 #define AE_VCPP
26 #elif defined(__GNUC__)
27 #define AE_GCC
28 #endif
29 
30 #if defined(_M_IA64) || defined(__ia64__)
31 #define AE_ARCH_IA64
32 #elif defined(_WIN64) || defined(__amd64__) || defined(_M_X64) || defined(__x86_64__)
33 #define AE_ARCH_X64
34 #elif defined(_M_IX86) || defined(__i386__)
35 #define AE_ARCH_X86
36 #elif defined(_M_PPC) || defined(__powerpc__)
37 #define AE_ARCH_PPC
38 #else
39 #define AE_ARCH_UNKNOWN
40 #endif
41 
42 // AE_UNUSED
43 #define AE_UNUSED(x) ((void)x)
44 
45 // AE_NO_TSAN
46 #if defined(__has_feature)
47 #if __has_feature(thread_sanitizer)
48 #define AE_NO_TSAN __attribute__((no_sanitize("thread")))
49 #else
50 #define AE_NO_TSAN
51 #endif
52 #else
53 #define AE_NO_TSAN
54 #endif
55 
56 // AE_FORCEINLINE
57 #if defined(AE_VCPP) || defined(AE_ICC)
58 #define AE_FORCEINLINE __forceinline
59 #elif defined(AE_GCC)
60 //#define AE_FORCEINLINE __attribute__((always_inline))
61 #define AE_FORCEINLINE inline
62 #else
63 #define AE_FORCEINLINE inline
64 #endif
65 
66 // AE_ALIGN
67 #if defined(AE_VCPP) || defined(AE_ICC)
68 #define AE_ALIGN(x) __declspec(align(x))
69 #elif defined(AE_GCC)
70 #define AE_ALIGN(x) __attribute__((aligned(x)))
71 #else
72 // Assume GCC compliant syntax...
73 #define AE_ALIGN(x) __attribute__((aligned(x)))
74 #endif
75 
76 // Portable atomic fences implemented below:
77 
78 namespace moodycamel
79 {
81 {
87 
88  // memory_order_sync: Forces a full sync:
89  // #LoadLoad, #LoadStore, #StoreStore, and most significantly, #StoreLoad
91 };
92 
93 } // end namespace moodycamel
94 
95 #if (defined(AE_VCPP) && (_MSC_VER < 1700 || defined(__cplusplus_cli))) || (defined(AE_ICC) && __INTEL_COMPILER < 1600)
96 // VS2010 and ICC13 don't support std::atomic_*_fence, implement our own fences
97 
98 #include <intrin.h>
99 
100 #if defined(AE_ARCH_X64) || defined(AE_ARCH_X86)
101 #define AeFullSync _mm_mfence
102 #define AeLiteSync _mm_mfence
103 #elif defined(AE_ARCH_IA64)
104 #define AeFullSync __mf
105 #define AeLiteSync __mf
106 #elif defined(AE_ARCH_PPC)
107 #include <ppcintrinsics.h>
108 #define AeFullSync __sync
109 #define AeLiteSync __lwsync
110 #endif
111 
112 #ifdef AE_VCPP
113 #pragma warning(push)
114 #pragma warning(disable : 4365) // Disable erroneous 'conversion from long to unsigned int, signed/unsigned mismatch'
115  // error when using `assert`
116 #ifdef __cplusplus_cli
117 #pragma managed(push, off)
118 #endif
119 #endif
120 
121 namespace moodycamel
122 {
124 {
125  switch (order)
126  {
128  break;
130  _ReadBarrier();
131  break;
133  _WriteBarrier();
134  break;
136  _ReadWriteBarrier();
137  break;
139  _ReadWriteBarrier();
140  break;
141  default:
142  assert(false);
143  }
144 }
145 
146 // x86/x64 have a strong memory model -- all loads and stores have
147 // acquire and release semantics automatically (so only need compiler
148 // barriers for those).
149 #if defined(AE_ARCH_X86) || defined(AE_ARCH_X64)
151 {
152  switch (order)
153  {
155  break;
157  _ReadBarrier();
158  break;
160  _WriteBarrier();
161  break;
163  _ReadWriteBarrier();
164  break;
166  _ReadWriteBarrier();
167  AeFullSync();
168  _ReadWriteBarrier();
169  break;
170  default:
171  assert(false);
172  }
173 }
174 #else
176 {
177  // Non-specialized arch, use heavier memory barriers everywhere just in case :-(
178  switch (order)
179  {
181  break;
183  _ReadBarrier();
184  AeLiteSync();
185  _ReadBarrier();
186  break;
188  _WriteBarrier();
189  AeLiteSync();
190  _WriteBarrier();
191  break;
193  _ReadWriteBarrier();
194  AeLiteSync();
195  _ReadWriteBarrier();
196  break;
198  _ReadWriteBarrier();
199  AeFullSync();
200  _ReadWriteBarrier();
201  break;
202  default:
203  assert(false);
204  }
205 }
206 #endif
207 } // end namespace moodycamel
208 #else
209 // Use standard library of atomics
210 #include <atomic>
211 
212 namespace moodycamel
213 {
215 {
216  switch (order)
217  {
219  break;
221  std::atomic_signal_fence(std::memory_order_acquire);
222  break;
224  std::atomic_signal_fence(std::memory_order_release);
225  break;
227  std::atomic_signal_fence(std::memory_order_acq_rel);
228  break;
230  std::atomic_signal_fence(std::memory_order_seq_cst);
231  break;
232  default:
233  assert(false);
234  }
235 }
236 
238 {
239  switch (order)
240  {
242  break;
244  std::atomic_thread_fence(std::memory_order_acquire);
245  break;
247  std::atomic_thread_fence(std::memory_order_release);
248  break;
250  std::atomic_thread_fence(std::memory_order_acq_rel);
251  break;
253  std::atomic_thread_fence(std::memory_order_seq_cst);
254  break;
255  default:
256  assert(false);
257  }
258 }
259 
260 } // end namespace moodycamel
261 
262 #endif
263 
264 #if !defined(AE_VCPP) || (_MSC_VER >= 1700 && !defined(__cplusplus_cli))
265 #define AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC
266 #endif
267 
268 #ifdef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC
269 #include <atomic>
270 #endif
271 #include <utility>
272 
273 // WARNING: *NOT* A REPLACEMENT FOR std::atomic. READ CAREFULLY:
274 // Provides basic support for atomic variables -- no memory ordering guarantees are provided.
275 // The guarantee of atomicity is only made for types that already have atomic load and store guarantees
276 // at the hardware level -- on most platforms this generally means aligned pointers and integers (only).
277 namespace moodycamel
278 {
279 template <typename T>
281 {
282 public:
284  {
285  }
286 #ifdef AE_VCPP
287 #pragma warning(push)
288 #pragma warning(disable : 4100) // Get rid of (erroneous) 'unreferenced formal parameter' warning
289 #endif
290  template <typename U>
291  AE_NO_TSAN weak_atomic(U&& x) : value(std::forward<U>(x))
292  {
293  }
294 #ifdef __cplusplus_cli
295  // Work around bug with universal reference/nullptr combination that only appears when /clr is on
296  AE_NO_TSAN weak_atomic(nullptr_t) : value(nullptr)
297  {
298  }
299 #endif
300  AE_NO_TSAN weak_atomic(weak_atomic const& other) : value(other.load())
301  {
302  }
303  AE_NO_TSAN weak_atomic(weak_atomic&& other) : value(std::move(other.load()))
304  {
305  }
306 #ifdef AE_VCPP
307 #pragma warning(pop)
308 #endif
309 
310  AE_FORCEINLINE operator T() const AE_NO_TSAN
311  {
312  return load();
313  }
314 
315 #ifndef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC
316  template <typename U>
317  AE_FORCEINLINE weak_atomic const& operator=(U&& x) AE_NO_TSAN
318  {
319  value = std::forward<U>(x);
320  return *this;
321  }
322  AE_FORCEINLINE weak_atomic const& operator=(weak_atomic const& other) AE_NO_TSAN
323  {
324  value = other.value;
325  return *this;
326  }
327 
328  AE_FORCEINLINE T load() const AE_NO_TSAN
329  {
330  return value;
331  }
332 
334  {
335 #if defined(AE_ARCH_X64) || defined(AE_ARCH_X86)
336  if (sizeof(T) == 4)
337  return _InterlockedExchangeAdd((long volatile*)&value, (long)increment);
338 #if defined(_M_AMD64)
339  else if (sizeof(T) == 8)
340  return _InterlockedExchangeAdd64((long long volatile*)&value, (long long)increment);
341 #endif
342 #else
343 #error Unsupported platform
344 #endif
345  assert(false && "T must be either a 32 or 64 bit type");
346  return value;
347  }
348 
350  {
351 #if defined(AE_ARCH_X64) || defined(AE_ARCH_X86)
352  if (sizeof(T) == 4)
353  return _InterlockedExchangeAdd((long volatile*)&value, (long)increment);
354 #if defined(_M_AMD64)
355  else if (sizeof(T) == 8)
356  return _InterlockedExchangeAdd64((long long volatile*)&value, (long long)increment);
357 #endif
358 #else
359 #error Unsupported platform
360 #endif
361  assert(false && "T must be either a 32 or 64 bit type");
362  return value;
363  }
364 #else
365  template <typename U>
366  AE_FORCEINLINE weak_atomic const& operator=(U&& x) AE_NO_TSAN
367  {
368  value.store(std::forward<U>(x), std::memory_order_relaxed);
369  return *this;
370  }
371 
372  AE_FORCEINLINE weak_atomic const& operator=(weak_atomic const& other) AE_NO_TSAN
373  {
375  return *this;
376  }
377 
379  {
380  return value.load(std::memory_order_relaxed);
381  }
382 
384  {
385  return value.fetch_add(increment, std::memory_order_acquire);
386  }
387 
389  {
390  return value.fetch_add(increment, std::memory_order_release);
391  }
392 #endif
393 
394 private:
395 #ifndef AE_USE_STD_ATOMIC_FOR_WEAK_ATOMIC
396  // No std::atomic support, but still need to circumvent compiler optimizations.
397  // `volatile` will make memory access slow, but is guaranteed to be reliable.
398  volatile T value;
399 #else
400  std::atomic<T> value;
401 #endif
402 };
403 
404 } // end namespace moodycamel
405 
406 // Portable single-producer, single-consumer semaphore below:
407 
408 #if defined(_WIN32)
409 // Avoid including windows.h in a header; we only need a handful of
410 // items, so we'll redeclare them here (this is relatively safe since
411 // the API generally has to remain stable between Windows versions).
412 // I know this is an ugly hack but it still beats polluting the global
413 // namespace with thousands of generic names or adding a .cpp for nothing.
414 extern "C" {
415 struct _SECURITY_ATTRIBUTES;
416 __declspec(dllimport) void* __stdcall CreateSemaphoreW(_SECURITY_ATTRIBUTES* lpSemaphoreAttributes, long lInitialCount,
417  long lMaximumCount, const wchar_t* lpName);
418 __declspec(dllimport) int __stdcall CloseHandle(void* hObject);
419 __declspec(dllimport) unsigned long __stdcall WaitForSingleObject(void* hHandle, unsigned long dwMilliseconds);
420 __declspec(dllimport) int __stdcall ReleaseSemaphore(void* hSemaphore, long lReleaseCount, long* lpPreviousCount);
421 }
422 #elif defined(__MACH__)
423 #include <mach/mach.h>
424 #elif defined(__unix__)
425 #include <semaphore.h>
426 #endif
427 
428 namespace moodycamel
429 {
430 // Code in the spsc_sema namespace below is an adaptation of Jeff Preshing's
431 // portable + lightweight semaphore implementations, originally from
432 // https://github.com/preshing/cpp11-on-multicore/blob/master/common/sema.h
433 // LICENSE:
434 // Copyright (c) 2015 Jeff Preshing
435 //
436 // This software is provided 'as-is', without any express or implied
437 // warranty. In no event will the authors be held liable for any damages
438 // arising from the use of this software.
439 //
440 // Permission is granted to anyone to use this software for any purpose,
441 // including commercial applications, and to alter it and redistribute it
442 // freely, subject to the following restrictions:
443 //
444 // 1. The origin of this software must not be misrepresented; you must not
445 // claim that you wrote the original software. If you use this software
446 // in a product, an acknowledgement in the product documentation would be
447 // appreciated but is not required.
448 // 2. Altered source versions must be plainly marked as such, and must not be
449 // misrepresented as being the original software.
450 // 3. This notice may not be removed or altered from any source distribution.
451 namespace spsc_sema
452 {
453 #if defined(_WIN32)
454 class Semaphore
455 {
456 private:
457  void* m_hSema;
458 
459  Semaphore(const Semaphore& other);
460  Semaphore& operator=(const Semaphore& other);
461 
462 public:
463  AE_NO_TSAN Semaphore(int initialCount = 0)
464  {
465  assert(initialCount >= 0);
466  const long maxLong = 0x7fffffff;
467  m_hSema = CreateSemaphoreW(nullptr, initialCount, maxLong, nullptr);
468  assert(m_hSema);
469  }
470 
471  AE_NO_TSAN ~Semaphore()
472  {
473  CloseHandle(m_hSema);
474  }
475 
476  bool wait() AE_NO_TSAN
477  {
478  const unsigned long infinite = 0xffffffff;
479  return WaitForSingleObject(m_hSema, infinite) == 0;
480  }
481 
482  bool try_wait() AE_NO_TSAN
483  {
484  return WaitForSingleObject(m_hSema, 0) == 0;
485  }
486 
487  bool timed_wait(std::uint64_t usecs) AE_NO_TSAN
488  {
489  return WaitForSingleObject(m_hSema, (unsigned long)(usecs / 1000)) == 0;
490  }
491 
492  void signal(int count = 1) AE_NO_TSAN
493  {
494  while (!ReleaseSemaphore(m_hSema, count, nullptr))
495  ;
496  }
497 };
498 #elif defined(__MACH__)
499 //---------------------------------------------------------
500 // Semaphore (Apple iOS and OSX)
501 // Can't use POSIX semaphores due to http://lists.apple.com/archives/darwin-kernel/2009/Apr/msg00010.html
502 //---------------------------------------------------------
503 class Semaphore
504 {
505 private:
506  semaphore_t m_sema;
507 
508  Semaphore(const Semaphore& other);
509  Semaphore& operator=(const Semaphore& other);
510 
511 public:
512  AE_NO_TSAN Semaphore(int initialCount = 0)
513  {
514  assert(initialCount >= 0);
515  kern_return_t rc = semaphore_create(mach_task_self(), &m_sema, SYNC_POLICY_FIFO, initialCount);
516  assert(rc == KERN_SUCCESS);
517  AE_UNUSED(rc);
518  }
519 
520  AE_NO_TSAN ~Semaphore()
521  {
522  semaphore_destroy(mach_task_self(), m_sema);
523  }
524 
525  bool wait() AE_NO_TSAN
526  {
527  return semaphore_wait(m_sema) == KERN_SUCCESS;
528  }
529 
530  bool try_wait() AE_NO_TSAN
531  {
532  return timed_wait(0);
533  }
534 
535  bool timed_wait(std::int64_t timeout_usecs) AE_NO_TSAN
536  {
537  mach_timespec_t ts;
538  ts.tv_sec = static_cast<unsigned int>(timeout_usecs / 1000000);
539  ts.tv_nsec = (timeout_usecs % 1000000) * 1000;
540 
541  // added in OSX 10.10:
542  // https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/APIDiffsMacOSX10_10SeedDiff/modules/Darwin.html
543  kern_return_t rc = semaphore_timedwait(m_sema, ts);
544  return rc == KERN_SUCCESS;
545  }
546 
547  void signal() AE_NO_TSAN
548  {
549  while (semaphore_signal(m_sema) != KERN_SUCCESS)
550  ;
551  }
552 
553  void signal(int count) AE_NO_TSAN
554  {
555  while (count-- > 0)
556  {
557  while (semaphore_signal(m_sema) != KERN_SUCCESS)
558  ;
559  }
560  }
561 };
562 #elif defined(__unix__)
563 //---------------------------------------------------------
564 // Semaphore (POSIX, Linux)
565 //---------------------------------------------------------
566 class Semaphore
567 {
568 private:
569  sem_t m_sema;
570 
571  Semaphore(const Semaphore& other);
572  Semaphore& operator=(const Semaphore& other);
573 
574 public:
575  AE_NO_TSAN Semaphore(int initialCount = 0)
576  {
577  assert(initialCount >= 0);
578  int rc = sem_init(&m_sema, 0, initialCount);
579  assert(rc == 0);
580  AE_UNUSED(rc);
581  }
582 
583  AE_NO_TSAN ~Semaphore()
584  {
585  sem_destroy(&m_sema);
586  }
587 
588  bool wait() AE_NO_TSAN
589  {
590  // http://stackoverflow.com/questions/2013181/gdb-causes-sem-wait-to-fail-with-eintr-error
591  int rc;
592  do
593  {
594  rc = sem_wait(&m_sema);
595  } while (rc == -1 && errno == EINTR);
596  return rc == 0;
597  }
598 
599  bool try_wait() AE_NO_TSAN
600  {
601  int rc;
602  do
603  {
604  rc = sem_trywait(&m_sema);
605  } while (rc == -1 && errno == EINTR);
606  return rc == 0;
607  }
608 
609  bool timed_wait(std::uint64_t usecs) AE_NO_TSAN
610  {
611  struct timespec ts;
612  const int usecs_in_1_sec = 1000000;
613  const int nsecs_in_1_sec = 1000000000;
614  clock_gettime(CLOCK_REALTIME, &ts);
615  ts.tv_sec += usecs / usecs_in_1_sec;
616  ts.tv_nsec += (usecs % usecs_in_1_sec) * 1000;
617  // sem_timedwait bombs if you have more than 1e9 in tv_nsec
618  // so we have to clean things up before passing it in
619  if (ts.tv_nsec >= nsecs_in_1_sec)
620  {
621  ts.tv_nsec -= nsecs_in_1_sec;
622  ++ts.tv_sec;
623  }
624 
625  int rc;
626  do
627  {
628  rc = sem_timedwait(&m_sema, &ts);
629  } while (rc == -1 && errno == EINTR);
630  return rc == 0;
631  }
632 
633  void signal() AE_NO_TSAN
634  {
635  while (sem_post(&m_sema) == -1)
636  ;
637  }
638 
639  void signal(int count) AE_NO_TSAN
640  {
641  while (count-- > 0)
642  {
643  while (sem_post(&m_sema) == -1)
644  ;
645  }
646  }
647 };
648 #else
649 #error Unsupported platform! (No semaphore wrapper available)
650 #endif
651 
652 //---------------------------------------------------------
653 // LightweightSemaphore
654 //---------------------------------------------------------
656 {
657 public:
658  typedef std::make_signed<std::size_t>::type ssize_t;
659 
660 private:
662  Semaphore m_sema;
663 
664  bool waitWithPartialSpinning(std::int64_t timeout_usecs = -1) AE_NO_TSAN
665  {
666  ssize_t oldCount;
667  // Is there a better way to set the initial spin count?
668  // If we lower it to 1000, testBenaphore becomes 15x slower on my Core i7-5930K Windows PC,
669  // as threads start hitting the kernel semaphore.
670  int spin = 10000;
671  while (--spin >= 0)
672  {
673  if (m_count.load() > 0)
674  {
675  m_count.fetch_add_acquire(-1);
676  return true;
677  }
678  compiler_fence(memory_order_acquire); // Prevent the compiler from collapsing the loop.
679  }
680  oldCount = m_count.fetch_add_acquire(-1);
681  if (oldCount > 0)
682  return true;
683  if (timeout_usecs < 0)
684  return m_sema.wait();
685  if (m_sema.timed_wait(timeout_usecs))
686  return true;
687  // At this point, we've timed out waiting for the semaphore, but the
688  // count is still decremented indicating we may still be waiting on
689  // it. So we have to re-adjust the count, but only if the semaphore
690  // wasn't signaled enough times for us too since then. If it was, we
691  // need to release the semaphore too.
692  while (true)
693  {
694  oldCount = m_count.fetch_add_release(1);
695  if (oldCount < 0)
696  return false; // successfully restored things to the way they were
697  // Oh, the producer thread just signaled the semaphore after all. Try again:
698  oldCount = m_count.fetch_add_acquire(-1);
699  if (oldCount > 0 && m_sema.try_wait())
700  return true;
701  }
702  }
703 
704 public:
705  AE_NO_TSAN LightweightSemaphore(ssize_t initialCount = 0) : m_count(initialCount)
706  {
707  assert(initialCount >= 0);
708  }
709 
711  {
712  if (m_count.load() > 0)
713  {
714  m_count.fetch_add_acquire(-1);
715  return true;
716  }
717  return false;
718  }
719 
721  {
722  return tryWait() || waitWithPartialSpinning();
723  }
724 
725  bool wait(std::int64_t timeout_usecs) AE_NO_TSAN
726  {
727  return tryWait() || waitWithPartialSpinning(timeout_usecs);
728  }
729 
730  void signal(ssize_t count = 1) AE_NO_TSAN
731  {
732  assert(count >= 0);
733  ssize_t oldCount = m_count.fetch_add_release(count);
734  assert(oldCount >= -1);
735  if (oldCount < 0)
736  {
737  m_sema.signal(1);
738  }
739  }
740 
741  ssize_t availableApprox() const AE_NO_TSAN
742  {
743  ssize_t count = m_count.load();
744  return count > 0 ? count : 0;
745  }
746 };
747 } // end namespace spsc_sema
748 } // end namespace moodycamel
749 
750 #if defined(AE_VCPP) && (_MSC_VER < 1700 || defined(__cplusplus_cli))
751 #pragma warning(pop)
752 #ifdef __cplusplus_cli
753 #pragma managed(pop)
754 #endif
755 #endif
#define AE_UNUSED(x)
Definition: atomicops.h:43
AE_NO_TSAN LightweightSemaphore(ssize_t initialCount=0)
Definition: atomicops.h:705
AE_NO_TSAN weak_atomic(weak_atomic const &other)
Definition: atomicops.h:300
void wait(int seconds)
AE_FORCEINLINE weak_atomic const & operator=(weak_atomic const &other) AE_NO_TSAN
Definition: atomicops.h:372
bool wait(std::int64_t timeout_usecs) AE_NO_TSAN
Definition: atomicops.h:725
AE_FORCEINLINE T fetch_add_acquire(T increment) AE_NO_TSAN
Definition: atomicops.h:383
#define AE_NO_TSAN
Definition: atomicops.h:53
std::atomic< T > value
Definition: atomicops.h:400
ssize_t availableApprox() const AE_NO_TSAN
Definition: atomicops.h:741
AE_FORCEINLINE void fence(memory_order order) AE_NO_TSAN
Definition: atomicops.h:237
AE_FORCEINLINE T load() const AE_NO_TSAN
Definition: atomicops.h:378
AE_NO_TSAN weak_atomic(weak_atomic &&other)
Definition: atomicops.h:303
AE_NO_TSAN weak_atomic()
Definition: atomicops.h:283
AE_NO_TSAN weak_atomic(U &&x)
Definition: atomicops.h:291
void signal(ssize_t count=1) AE_NO_TSAN
Definition: atomicops.h:730
ROSCPP_DECL void spin()
std::make_signed< std::size_t >::type ssize_t
Definition: atomicops.h:658
AE_FORCEINLINE T fetch_add_release(T increment) AE_NO_TSAN
Definition: atomicops.h:388
void move(std::vector< T > &a, std::vector< T > &b)
AE_FORCEINLINE void compiler_fence(memory_order order) AE_NO_TSAN
Definition: atomicops.h:214
bool waitWithPartialSpinning(std::int64_t timeout_usecs=-1) AE_NO_TSAN
Definition: atomicops.h:664
AE_FORCEINLINE weak_atomic const & operator=(U &&x) AE_NO_TSAN
Definition: atomicops.h:366
void increment(int *value)
#define AE_FORCEINLINE
Definition: atomicops.h:63


pf_driver
Author(s): Harsh Deshpande
autogenerated on Fri Feb 24 2023 03:59:35