summaryrefslogtreecommitdiff
path: root/cryptopp/crypto/trdlocal.cpp
diff options
context:
space:
mode:
authorwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-11-26 14:19:43 +0000
committerwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-11-26 14:19:43 +0000
commit7aff1e4cb053394db57c2814d5fe1e6493e0cc75 (patch)
treec8585e44049b37e4da152495c954242204c2c38d /cryptopp/crypto/trdlocal.cpp
parent6f3d69266933ef120d229e0daf2da164b77214d0 (diff)
Project folders rename part 2
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@214 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'cryptopp/crypto/trdlocal.cpp')
-rw-r--r--cryptopp/crypto/trdlocal.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/cryptopp/crypto/trdlocal.cpp b/cryptopp/crypto/trdlocal.cpp
deleted file mode 100644
index 6cf1799..0000000
--- a/cryptopp/crypto/trdlocal.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// trdlocal.cpp - written and placed in the public domain by Wei Dai
-
-#include "pch.h"
-
-#ifndef CRYPTOPP_IMPORTS
-#ifdef THREADS_AVAILABLE
-
-#include "trdlocal.h"
-
-#ifdef HAS_WINTHREADS
-#include <windows.h>
-#endif
-
-NAMESPACE_BEGIN(CryptoPP)
-
-ThreadLocalStorage::Err::Err(const std::string& operation, int error)
- : OS_Error(OTHER_ERROR, "ThreadLocalStorage: " + operation + " operation failed with error 0x" + IntToString(error, 16), operation, error)
-{
-}
-
-ThreadLocalStorage::ThreadLocalStorage()
-{
-#ifdef HAS_WINTHREADS
- m_index = TlsAlloc();
- if (m_index == TLS_OUT_OF_INDEXES)
- throw Err("TlsAlloc", GetLastError());
-#else
- int error = pthread_key_create(&m_index, NULL);
- if (error)
- throw Err("pthread_key_create", error);
-#endif
-}
-
-ThreadLocalStorage::~ThreadLocalStorage()
-{
-#ifdef HAS_WINTHREADS
- if (!TlsFree(m_index))
- throw Err("TlsFree", GetLastError());
-#else
- int error = pthread_key_delete(m_index);
- if (error)
- throw Err("pthread_key_delete", error);
-#endif
-}
-
-void ThreadLocalStorage::SetValue(void *value)
-{
-#ifdef HAS_WINTHREADS
- if (!TlsSetValue(m_index, value))
- throw Err("TlsSetValue", GetLastError());
-#else
- int error = pthread_setspecific(m_index, value);
- if (error)
- throw Err("pthread_key_getspecific", error);
-#endif
-}
-
-void *ThreadLocalStorage::GetValue() const
-{
-#ifdef HAS_WINTHREADS
- void *result = TlsGetValue(m_index);
- if (!result && GetLastError() != NO_ERROR)
- throw Err("TlsGetValue", GetLastError());
-#else
- void *result = pthread_getspecific(m_index);
-#endif
- return result;
-}
-
-NAMESPACE_END
-
-#endif // #ifdef THREADS_AVAILABLE
-#endif