source: git/src-cryptopp/trdlocal.h

Last change on this file was e230cb0, checked in by David Stainton <dstainton415@…>, at 2016-10-12T13:27:29Z

Add cryptopp from tag CRYPTOPP_5_6_5

  • Property mode set to 100644
File size: 850 bytes
Line 
1#ifndef CRYPTOPP_TRDLOCAL_H
2#define CRYPTOPP_TRDLOCAL_H
3
4#include "config.h"
5
6#if !defined(NO_OS_DEPENDENCE) && defined(THREADS_AVAILABLE)
7
8#include "misc.h"
9
10#ifdef HAS_WINTHREADS
11typedef unsigned long ThreadLocalIndexType;
12#else
13#include <pthread.h>
14typedef pthread_key_t ThreadLocalIndexType;
15#endif
16
17NAMESPACE_BEGIN(CryptoPP)
18
19//! thread local storage
20class CRYPTOPP_DLL ThreadLocalStorage : public NotCopyable
21{
22public:
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
30        ThreadLocalStorage();
31        ~ThreadLocalStorage() CRYPTOPP_THROW;
32
33        void SetValue(void *value);
34        void *GetValue() const;
35
36private:
37        ThreadLocalIndexType m_index;
38};
39
40NAMESPACE_END
41
42#endif  // THREADS_AVAILABLE
43
44#endif  // CRYPTOPP_TRDLOCAL_H
Note: See TracBrowser for help on using the repository browser.