Crypto++
trdlocal.h
1 #ifndef CRYPTOPP_TRDLOCAL_H
2 #define CRYPTOPP_TRDLOCAL_H
3 
4 #include "config.h"
5 
6 #ifdef THREADS_AVAILABLE
7 
8 #include "misc.h"
9 
10 #ifdef HAS_WINTHREADS
11 typedef unsigned long ThreadLocalIndexType;
12 #else
13 #include <pthread.h>
14 typedef pthread_key_t ThreadLocalIndexType;
15 #endif
16 
17 NAMESPACE_BEGIN(CryptoPP)
18 
19 //! thread local storage
20 class CRYPTOPP_DLL ThreadLocalStorage : public NotCopyable
21 {
22 public:
23  //! exception thrown by ThreadLocalStorage class
24  class Err : public OS_Error
25  {
26  public:
27  Err(const std::string& operation, int error);
28  };
29 
32 
33  void SetValue(void *value);
34  void *GetValue() const;
35 
36 private:
37  ThreadLocalIndexType m_index;
38 };
39 
40 NAMESPACE_END
41 
42 #endif // #ifdef THREADS_AVAILABLE
43 
44 #endif
exception thrown by ThreadLocalStorage class
Definition: trdlocal.h:24
error reported by the operating system
Definition: cryptlib.h:179
thread local storage
Definition: trdlocal.h:20