mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-15 15:16:49 +02:00
serialized access to startImpl() functions
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include "Poco/Foundation.h"
|
#include "Poco/Foundation.h"
|
||||||
#include "Poco/Runnable.h"
|
#include "Poco/Runnable.h"
|
||||||
|
#include "Poco/Mutex.h"
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -117,6 +118,7 @@ private:
|
|||||||
HANDLE _thread;
|
HANDLE _thread;
|
||||||
int _prio;
|
int _prio;
|
||||||
std::size_t _stackSize;
|
std::size_t _stackSize;
|
||||||
|
Mutex _mutex;
|
||||||
|
|
||||||
static DWORD _currentKey;
|
static DWORD _currentKey;
|
||||||
};
|
};
|
||||||
|
@@ -83,6 +83,8 @@ void ThreadImpl::setPriorityImpl(int prio)
|
|||||||
|
|
||||||
void ThreadImpl::startImpl(Runnable& target)
|
void ThreadImpl::startImpl(Runnable& target)
|
||||||
{
|
{
|
||||||
|
Mutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (isRunningImpl())
|
if (isRunningImpl())
|
||||||
throw SystemException("thread already running");
|
throw SystemException("thread already running");
|
||||||
|
|
||||||
@@ -94,6 +96,8 @@ void ThreadImpl::startImpl(Runnable& target)
|
|||||||
|
|
||||||
void ThreadImpl::startImpl(Callback target, void* pData)
|
void ThreadImpl::startImpl(Callback target, void* pData)
|
||||||
{
|
{
|
||||||
|
Mutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (isRunningImpl())
|
if (isRunningImpl())
|
||||||
throw SystemException("thread already running");
|
throw SystemException("thread already running");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user