Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# trdlocal.h

    00001 #ifndef CRYPTOPP_TRDLOCAL_H
    00002 #define CRYPTOPP_TRDLOCAL_H
    00003
    00004 #include "config.h"
    00005
    00006 #ifdef THREADS_AVAILABLE
    00007
    00008 #include "misc.h"
    00009
    00010 #ifdef HAS_WINTHREADS
    00011 typedef unsigned long ThreadLocalIndexType;
    00012 #else
    00013 #include <pthread.h>
    00014 typedef pthread_key_t ThreadLocalIndexType;
    00015 #endif
    00016
    00017 NAMESPACE_BEGIN(CryptoPP)
    00018
    00019 //! thread local storage
    00020 class CRYPTOPP_DLL ThreadLocalStorage : public NotCopyable
    00021 {
    00022 public:
    00023         //! exception thrown by ThreadLocalStorage class
    00024         class Err : public OS_Error
    00025         {
    00026         public:
    00027                 Err(const std::string& operation, int error);
    00028         };
    00029
    00030         ThreadLocalStorage();
    00031         ~ThreadLocalStorage();
    00032
    00033         void SetValue(void *value);
    00034         void *GetValue() const;
    00035
    00036 private:
    00037         ThreadLocalIndexType m_index;
    00038 };
    00039
    00040 NAMESPACE_END
    00041
    00042 #endif  // #ifdef THREADS_AVAILABLE
    00043
    00044 #endif