Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
738 B

  1. #ifndef CRYPTOPP_TRDLOCAL_H
  2. #define CRYPTOPP_TRDLOCAL_H
  3. #include "config.h"
  4. #ifdef THREADS_AVAILABLE
  5. #include "misc.h"
  6. #ifdef HAS_WINTHREADS
  7. typedef unsigned long ThreadLocalIndexType;
  8. #else
  9. #include <pthread.h>
  10. typedef pthread_key_t ThreadLocalIndexType;
  11. #endif
  12. NAMESPACE_BEGIN(CryptoPP)
  13. //! thread local storage
  14. class CRYPTOPP_DLL ThreadLocalStorage : public NotCopyable
  15. {
  16. public:
  17. //! exception thrown by ThreadLocalStorage class
  18. class Err : public OS_Error
  19. {
  20. public:
  21. Err(const std::string& operation, int error);
  22. };
  23. ThreadLocalStorage();
  24. ~ThreadLocalStorage();
  25. void SetValue(void *value);
  26. void *GetValue() const;
  27. private:
  28. ThreadLocalIndexType m_index;
  29. };
  30. NAMESPACE_END
  31. #endif // #ifdef THREADS_AVAILABLE
  32. #endif