integrated fixed from 1.3.4

This commit is contained in:
Guenter Obiltschnig
2009-02-18 13:12:25 +00:00
parent 32642ba9c1
commit 64a7203a0d
8 changed files with 72 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
//
// Thread_POSIX.h
//
// $Id: //poco/svn/Foundation/include/Poco/Thread_POSIX.h#2 $
// $Id: //poco/Main/Foundation/include/Poco/Thread_POSIX.h#8 $
//
// Library: Foundation
// Package: Threading
@@ -108,6 +108,31 @@ protected:
static int reverseMapPrio(int osPrio);
private:
class CurrentThreadHolder
{
public:
CurrentThreadHolder()
{
if (pthread_key_create(&_key, NULL))
throw SystemException("cannot allocate thread context key");
}
~CurrentThreadHolder()
{
pthread_key_delete(_key);
}
ThreadImpl* get() const
{
return reinterpret_cast<ThreadImpl*>(pthread_getspecific(_key));
}
void set(ThreadImpl* pThread)
{
pthread_setspecific(_key, pThread);
}
private:
pthread_key_t _key;
};
struct ThreadData: public RefCountedObject
{
ThreadData():
@@ -131,8 +156,7 @@ private:
AutoPtr<ThreadData> _pData;
static pthread_key_t _currentKey;
static bool _haveCurrentKey;
static CurrentThreadHolder _currentThreadHolder;
#if defined(POCO_OS_FAMILY_UNIX)
SignalHandler::JumpBufferVec _jumpBufferVec;