libcds.h 502 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include <thread>
  3. #include "NiftyCounter.h"
  4. #if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
  5. # include "mingw-std-threads/thread"
  6. # include "mingw-std-threads/mutex"
  7. #endif
  8. namespace _cdslib
  9. {
  10. void init();
  11. void deinit();
  12. void thread_init();
  13. void thread_deinit();
  14. static NiftyCounter<init, deinit> _counter;
  15. static thread_local NiftyCounterTL<_cdslib::thread_init, _cdslib::thread_deinit> _thread_counter;
  16. }
  17. #define CDS_THREAD_GUARD() (void)_cdslib::_thread_counter;