mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
Merge branch 'issue_532' into issue_532-3 with edits
This commit is contained in:
@@ -45,16 +45,13 @@ class Foundation_API Mutex: private MutexImpl
|
|||||||
/// A Mutex (mutual exclusion) is a synchronization
|
/// A Mutex (mutual exclusion) is a synchronization
|
||||||
/// mechanism used to control access to a shared resource
|
/// mechanism used to control access to a shared resource
|
||||||
/// in a concurrent (multithreaded) scenario.
|
/// in a concurrent (multithreaded) scenario.
|
||||||
/// Mutexes are recursive, that is, the same mutex can be
|
|
||||||
/// locked multiple times by the same thread (but, of course,
|
|
||||||
/// not by other threads).
|
|
||||||
/// Using the ScopedLock class is the preferred way to automatically
|
/// Using the ScopedLock class is the preferred way to automatically
|
||||||
/// lock and unlock a mutex.
|
/// lock and unlock a mutex.
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Poco::ScopedLock<Mutex> ScopedLock;
|
typedef Poco::ScopedLock<Mutex> ScopedLock;
|
||||||
|
|
||||||
Mutex();
|
explicit Mutex(bool recursive = true);
|
||||||
/// creates the Mutex.
|
/// creates the Mutex.
|
||||||
|
|
||||||
~Mutex();
|
~Mutex();
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ namespace Poco {
|
|||||||
class Foundation_API MutexImpl
|
class Foundation_API MutexImpl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
MutexImpl();
|
MutexImpl(bool recursive);
|
||||||
MutexImpl(bool fast);
|
|
||||||
~MutexImpl();
|
~MutexImpl();
|
||||||
void lockImpl();
|
void lockImpl();
|
||||||
bool tryLockImpl();
|
bool tryLockImpl();
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ namespace Poco {
|
|||||||
class Foundation_API MutexImpl
|
class Foundation_API MutexImpl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
MutexImpl();
|
MutexImpl(bool recursive);
|
||||||
MutexImpl(bool fast);
|
|
||||||
~MutexImpl();
|
~MutexImpl();
|
||||||
void lockImpl();
|
void lockImpl();
|
||||||
bool tryLockImpl();
|
bool tryLockImpl();
|
||||||
|
|||||||
@@ -31,25 +31,46 @@ namespace Poco {
|
|||||||
class Foundation_API MutexImpl
|
class Foundation_API MutexImpl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
MutexImpl();
|
MutexImpl(bool recursive);
|
||||||
~MutexImpl();
|
~MutexImpl();
|
||||||
void lockImpl();
|
void lockImpl();
|
||||||
bool tryLockImpl();
|
bool tryLockImpl();
|
||||||
bool tryLockImpl(long milliseconds);
|
bool tryLockImpl(long milliseconds);
|
||||||
void unlockImpl();
|
void unlockImpl();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CRITICAL_SECTION _cs;
|
||||||
|
int _lockCount;
|
||||||
|
const bool _recursive;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API FastMutexImpl
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FastMutexImpl();
|
||||||
|
~FastMutexImpl();
|
||||||
|
void lockImpl();
|
||||||
|
bool tryLockImpl();
|
||||||
|
bool tryLockImpl(long milliseconds);
|
||||||
|
void unlockImpl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CRITICAL_SECTION _cs;
|
CRITICAL_SECTION _cs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef MutexImpl FastMutexImpl;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// inlines
|
// inlines
|
||||||
//
|
//
|
||||||
inline void MutexImpl::lockImpl()
|
inline void MutexImpl::unlockImpl()
|
||||||
|
{
|
||||||
|
--_lockCount;
|
||||||
|
LeaveCriticalSection(&_cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void FastMutexImpl::lockImpl()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -62,7 +83,7 @@ inline void MutexImpl::lockImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool MutexImpl::tryLockImpl()
|
inline bool FastMutexImpl::tryLockImpl()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -75,7 +96,7 @@ inline bool MutexImpl::tryLockImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void MutexImpl::unlockImpl()
|
inline void FastMutexImpl::unlockImpl()
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(&_cs);
|
LeaveCriticalSection(&_cs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,21 +31,35 @@ namespace Poco {
|
|||||||
class Foundation_API MutexImpl
|
class Foundation_API MutexImpl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
MutexImpl();
|
MutexImpl(bool recursive);
|
||||||
~MutexImpl();
|
~MutexImpl();
|
||||||
void lockImpl();
|
void lockImpl();
|
||||||
bool tryLockImpl();
|
bool tryLockImpl();
|
||||||
bool tryLockImpl(long milliseconds);
|
bool tryLockImpl(long milliseconds);
|
||||||
void unlockImpl();
|
void unlockImpl();
|
||||||
|
|
||||||
|
private:
|
||||||
|
HANDLE _mutex;
|
||||||
|
int _lockCount;
|
||||||
|
const bool _recursive;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Foundation_API FastMutexImpl
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
FastMutexImpl();
|
||||||
|
~FastMutexImpl();
|
||||||
|
void lockImpl();
|
||||||
|
bool tryLockImpl();
|
||||||
|
bool tryLockImpl(long milliseconds);
|
||||||
|
void unlockImpl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HANDLE _mutex;
|
HANDLE _mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef MutexImpl FastMutexImpl;
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
Mutex::Mutex()
|
Mutex::Mutex(bool recursive)
|
||||||
|
: MutexImpl(recursive)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl()
|
MutexImpl::MutexImpl(bool recursive)
|
||||||
{
|
{
|
||||||
#if defined(POCO_VXWORKS)
|
#if defined(POCO_VXWORKS)
|
||||||
// This workaround is for VxWorks 5.x where
|
// This workaround is for VxWorks 5.x where
|
||||||
@@ -50,34 +50,9 @@ MutexImpl::MutexImpl()
|
|||||||
pthread_mutexattr_t attr;
|
pthread_mutexattr_t attr;
|
||||||
pthread_mutexattr_init(&attr);
|
pthread_mutexattr_init(&attr);
|
||||||
#if defined(PTHREAD_MUTEX_RECURSIVE_NP)
|
#if defined(PTHREAD_MUTEX_RECURSIVE_NP)
|
||||||
pthread_mutexattr_settype_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
pthread_mutexattr_settype_np(&attr, recursive ? PTHREAD_MUTEX_RECURSIVE_NP : PTHREAD_MUTEX_NORMAL_NP);
|
||||||
#elif !defined(POCO_VXWORKS)
|
|
||||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
||||||
#endif
|
|
||||||
if (pthread_mutex_init(&_mutex, &attr))
|
|
||||||
{
|
|
||||||
pthread_mutexattr_destroy(&attr);
|
|
||||||
throw SystemException("cannot create mutex");
|
|
||||||
}
|
|
||||||
pthread_mutexattr_destroy(&attr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl(bool fast)
|
|
||||||
{
|
|
||||||
#if defined(POCO_VXWORKS)
|
|
||||||
// This workaround is for VxWorks 5.x where
|
|
||||||
// pthread_mutex_init() won't properly initialize the mutex
|
|
||||||
// resulting in a subsequent freeze in pthread_mutex_destroy()
|
|
||||||
// if the mutex has never been used.
|
|
||||||
std::memset(&_mutex, 0, sizeof(_mutex));
|
|
||||||
#endif
|
|
||||||
pthread_mutexattr_t attr;
|
|
||||||
pthread_mutexattr_init(&attr);
|
|
||||||
#if defined(PTHREAD_MUTEX_RECURSIVE_NP)
|
|
||||||
pthread_mutexattr_settype_np(&attr, fast ? PTHREAD_MUTEX_NORMAL_NP : PTHREAD_MUTEX_RECURSIVE_NP);
|
|
||||||
#elif !defined(POCO_VXWORKS)
|
#elif !defined(POCO_VXWORKS)
|
||||||
pthread_mutexattr_settype(&attr, fast ? PTHREAD_MUTEX_NORMAL : PTHREAD_MUTEX_RECURSIVE);
|
pthread_mutexattr_settype(&attr, recursive ? PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_NORMAL);
|
||||||
#endif
|
#endif
|
||||||
if (pthread_mutex_init(&_mutex, &attr))
|
if (pthread_mutex_init(&_mutex, &attr))
|
||||||
{
|
{
|
||||||
@@ -144,7 +119,7 @@ bool MutexImpl::tryLockImpl(long milliseconds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FastMutexImpl::FastMutexImpl(): MutexImpl(true)
|
FastMutexImpl::FastMutexImpl(): MutexImpl(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,23 +21,15 @@
|
|||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl()
|
MutexImpl::MutexImpl(bool recursive)
|
||||||
{
|
{
|
||||||
_sem = semMCreate(SEM_INVERSION_SAFE | SEM_Q_PRIORITY);
|
if (recursive)
|
||||||
if (_sem == 0)
|
|
||||||
throw Poco::SystemException("cannot create mutex");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl(bool fast)
|
|
||||||
{
|
|
||||||
if (fast)
|
|
||||||
{
|
{
|
||||||
_sem = semBCreate(SEM_Q_PRIORITY, SEM_FULL);
|
_sem = semMCreate(SEM_INVERSION_SAFE | SEM_Q_PRIORITY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_sem = semMCreate(SEM_INVERSION_SAFE | SEM_Q_PRIORITY);
|
_sem = semBCreate(SEM_Q_PRIORITY, SEM_FULL);
|
||||||
}
|
}
|
||||||
if (_sem == 0)
|
if (_sem == 0)
|
||||||
throw Poco::SystemException("cannot create mutex");
|
throw Poco::SystemException("cannot create mutex");
|
||||||
@@ -57,7 +49,7 @@ bool MutexImpl::tryLockImpl(long milliseconds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FastMutexImpl::FastMutexImpl(): MutexImpl(true)
|
FastMutexImpl::FastMutexImpl(): MutexImpl(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,16 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/Mutex_WIN32.h"
|
#include "Poco/Mutex_WIN32.h"
|
||||||
|
#include "Poco/Thread.h"
|
||||||
#include "Poco/Timestamp.h"
|
#include "Poco/Timestamp.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl()
|
MutexImpl::MutexImpl(bool recursive)
|
||||||
|
: _lockCount(0)
|
||||||
|
, _recursive(recursive)
|
||||||
{
|
{
|
||||||
// the fct has a boolean return value under WInnNt/2000/XP but not on Win98
|
// the fct has a boolean return value under WInnNt/2000/XP but not on Win98
|
||||||
// the return only checks if the input address of &_cs was valid, so it is safe to omit it
|
// the return only checks if the input address of &_cs was valid, so it is safe to omit it
|
||||||
@@ -35,7 +38,87 @@ MutexImpl::~MutexImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MutexImpl::lockImpl()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EnterCriticalSection(&_cs);
|
||||||
|
++_lockCount;
|
||||||
|
|
||||||
|
if (!_recursive && _lockCount > 1)
|
||||||
|
{
|
||||||
|
// We're trying to go recursive so self-deadlock
|
||||||
|
Thread::current()->join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MutexImpl::tryLockImpl()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (TryEnterCriticalSection(&_cs) == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!_recursive && _lockCount > 0)
|
||||||
|
{
|
||||||
|
LeaveCriticalSection(&_cs);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
++_lockCount;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MutexImpl::tryLockImpl(long milliseconds)
|
bool MutexImpl::tryLockImpl(long milliseconds)
|
||||||
|
{
|
||||||
|
const int sleepMillis = 5;
|
||||||
|
Timestamp now;
|
||||||
|
Timestamp::TimeDiff diff(Timestamp::TimeDiff(milliseconds)*1000);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tryLockImpl())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
Sleep(sleepMillis);
|
||||||
|
} while (!now.isElapsed(diff));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FastMutexImpl::FastMutexImpl()
|
||||||
|
{
|
||||||
|
// the fct has a boolean return value under WInnNt/2000/XP but not on Win98
|
||||||
|
// the return only checks if the input address of &_cs was valid, so it is safe to omit it
|
||||||
|
InitializeCriticalSectionAndSpinCount(&_cs, 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FastMutexImpl::~FastMutexImpl()
|
||||||
|
{
|
||||||
|
DeleteCriticalSection(&_cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FastMutexImpl::tryLockImpl(long milliseconds)
|
||||||
{
|
{
|
||||||
const int sleepMillis = 5;
|
const int sleepMillis = 5;
|
||||||
Timestamp now;
|
Timestamp now;
|
||||||
|
|||||||
@@ -15,12 +15,16 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/Mutex_WINCE.h"
|
#include "Poco/Mutex_WINCE.h"
|
||||||
|
#include "Poco/Thread.h"
|
||||||
|
#include "Poco/Timestamp.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
MutexImpl::MutexImpl()
|
MutexImpl::MutexImpl(bool recursive)
|
||||||
|
: _lockCount(0)
|
||||||
|
, _recursive(recursive)
|
||||||
{
|
{
|
||||||
_mutex = CreateMutexW(NULL, FALSE, NULL);
|
_mutex = CreateMutexW(NULL, FALSE, NULL);
|
||||||
if (!_mutex) throw SystemException("cannot create mutex");
|
if (!_mutex) throw SystemException("cannot create mutex");
|
||||||
@@ -38,6 +42,12 @@ void MutexImpl::lockImpl()
|
|||||||
switch (WaitForSingleObject(_mutex, INFINITE))
|
switch (WaitForSingleObject(_mutex, INFINITE))
|
||||||
{
|
{
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
|
++_lockCount;
|
||||||
|
if (!_recursive && _lockCount > 1)
|
||||||
|
{
|
||||||
|
// We're trying to go recursive so self-deadlock
|
||||||
|
Thread::current()->join();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
throw SystemException("cannot lock mutex");
|
throw SystemException("cannot lock mutex");
|
||||||
@@ -46,6 +56,80 @@ void MutexImpl::lockImpl()
|
|||||||
|
|
||||||
|
|
||||||
bool MutexImpl::tryLockImpl()
|
bool MutexImpl::tryLockImpl()
|
||||||
|
{
|
||||||
|
switch (WaitForSingleObject(_mutex, 0))
|
||||||
|
{
|
||||||
|
case WAIT_TIMEOUT:
|
||||||
|
return false;
|
||||||
|
case WAIT_OBJECT_0:
|
||||||
|
if (!_recursive && _lockCount > 0)
|
||||||
|
{
|
||||||
|
ReleaseMutex(_mutex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
++_lockCount;
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MutexImpl::tryLockImpl(long milliseconds)
|
||||||
|
{
|
||||||
|
const int sleepMillis = 5;
|
||||||
|
Timestamp now;
|
||||||
|
Timestamp::TimeDiff diff(Timestamp::TimeDiff(milliseconds)*1000);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tryLockImpl())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
Sleep(sleepMillis);
|
||||||
|
} while (!now.isElapsed(diff));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MutexImpl::unlockImpl()
|
||||||
|
{
|
||||||
|
ReleaseMutex(_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FastMutexImpl::FastMutexImpl()
|
||||||
|
{
|
||||||
|
_mutex = CreateMutexW(NULL, FALSE, NULL);
|
||||||
|
if (!_mutex) throw SystemException("cannot create mutex");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FastMutexImpl::~FastMutexImpl()
|
||||||
|
{
|
||||||
|
CloseHandle(_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FastMutexImpl::lockImpl()
|
||||||
|
{
|
||||||
|
switch (WaitForSingleObject(_mutex, INFINITE))
|
||||||
|
{
|
||||||
|
case WAIT_OBJECT_0:
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
throw SystemException("cannot lock mutex");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FastMutexImpl::tryLockImpl()
|
||||||
{
|
{
|
||||||
switch (WaitForSingleObject(_mutex, 0))
|
switch (WaitForSingleObject(_mutex, 0))
|
||||||
{
|
{
|
||||||
@@ -59,7 +143,7 @@ bool MutexImpl::tryLockImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MutexImpl::tryLockImpl(long milliseconds)
|
bool FastMutexImpl::tryLockImpl(long milliseconds)
|
||||||
{
|
{
|
||||||
switch (WaitForSingleObject(_mutex, milliseconds + 1))
|
switch (WaitForSingleObject(_mutex, milliseconds + 1))
|
||||||
{
|
{
|
||||||
@@ -73,7 +157,7 @@ bool MutexImpl::tryLockImpl(long milliseconds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MutexImpl::unlockImpl()
|
void FastMutexImpl::unlockImpl()
|
||||||
{
|
{
|
||||||
ReleaseMutex(_mutex);
|
ReleaseMutex(_mutex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ objects = ActiveMethodTest ActivityTest ActiveDispatcherTest \
|
|||||||
NotificationsTestSuite NullStreamTest NumberFormatterTest \
|
NotificationsTestSuite NullStreamTest NumberFormatterTest \
|
||||||
NumberParserTest PathTest PatternFormatterTest PBKDF2EngineTest RWLockTest \
|
NumberParserTest PathTest PatternFormatterTest PBKDF2EngineTest RWLockTest \
|
||||||
RandomStreamTest RandomTest RegularExpressionTest SHA1EngineTest \
|
RandomStreamTest RandomTest RegularExpressionTest SHA1EngineTest \
|
||||||
SemaphoreTest ConditionTest SharedLibraryTest SharedLibraryTestSuite \
|
SemaphoreTest MutexTest ConditionTest SharedLibraryTest SharedLibraryTestSuite \
|
||||||
SimpleFileChannelTest StopwatchTest \
|
SimpleFileChannelTest StopwatchTest \
|
||||||
StreamConverterTest StreamCopierTest StreamTokenizerTest \
|
StreamConverterTest StreamCopierTest StreamTokenizerTest \
|
||||||
StreamsTestSuite StringTest StringTokenizerTest TaskTestSuite TaskTest \
|
StreamsTestSuite StringTest StringTokenizerTest TaskTestSuite TaskTest \
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ SOURCES="
|
|||||||
ManifestTest.cpp
|
ManifestTest.cpp
|
||||||
MemoryPoolTest.cpp
|
MemoryPoolTest.cpp
|
||||||
MemoryStreamTest.cpp
|
MemoryStreamTest.cpp
|
||||||
|
MutexTest.cpp
|
||||||
NDCTest.cpp
|
NDCTest.cpp
|
||||||
NotificationCenterTest.cpp
|
NotificationCenterTest.cpp
|
||||||
NotificationQueueTest.cpp
|
NotificationQueueTest.cpp
|
||||||
|
|||||||
@@ -1074,6 +1074,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.cpp"
|
RelativePath=".\src\ConditionTest.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.cpp"
|
RelativePath=".\src\RWLockTest.cpp"
|
||||||
>
|
>
|
||||||
@@ -1122,6 +1126,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.h"
|
RelativePath=".\src\ConditionTest.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.h"
|
RelativePath=".\src\RWLockTest.h"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -340,6 +340,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -477,6 +478,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -746,6 +749,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -343,6 +343,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -480,6 +481,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -746,6 +749,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -360,6 +360,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -498,6 +499,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -330,6 +330,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -740,6 +743,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -365,6 +365,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -503,6 +504,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -746,6 +749,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -388,6 +388,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -525,6 +526,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -743,6 +746,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -775,6 +775,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\ConditionTest.cpp">
|
RelativePath=".\src\ConditionTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.cpp">
|
RelativePath=".\src\RWLockTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -812,6 +815,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\ConditionTest.h">
|
RelativePath=".\src\ConditionTest.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.h">
|
RelativePath=".\src\RWLockTest.h">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -1043,6 +1043,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.cpp"
|
RelativePath=".\src\ConditionTest.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.cpp"
|
RelativePath=".\src\RWLockTest.cpp"
|
||||||
>
|
>
|
||||||
@@ -1091,6 +1095,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.h"
|
RelativePath=".\src\ConditionTest.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.h"
|
RelativePath=".\src\RWLockTest.h"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1029,6 +1029,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.cpp"
|
RelativePath=".\src\ConditionTest.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.cpp"
|
RelativePath=".\src\RWLockTest.cpp"
|
||||||
>
|
>
|
||||||
@@ -1077,6 +1081,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.h"
|
RelativePath=".\src\ConditionTest.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.h"
|
RelativePath=".\src\RWLockTest.h"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -359,6 +359,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -498,6 +499,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -339,6 +339,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -752,6 +755,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -365,6 +365,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -504,6 +505,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -749,6 +752,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -372,6 +372,7 @@
|
|||||||
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
<ClCompile Include="src\ActiveMethodTest.cpp" />
|
||||||
<ClCompile Include="src\ActivityTest.cpp" />
|
<ClCompile Include="src\ActivityTest.cpp" />
|
||||||
<ClCompile Include="src\ConditionTest.cpp" />
|
<ClCompile Include="src\ConditionTest.cpp" />
|
||||||
|
<ClCompile Include="src\MutexTest.cpp" />
|
||||||
<ClCompile Include="src\RWLockTest.cpp" />
|
<ClCompile Include="src\RWLockTest.cpp" />
|
||||||
<ClCompile Include="src\SemaphoreTest.cpp" />
|
<ClCompile Include="src\SemaphoreTest.cpp" />
|
||||||
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
<ClCompile Include="src\ThreadingTestSuite.cpp" />
|
||||||
@@ -510,6 +511,7 @@
|
|||||||
<ClInclude Include="src\ActiveMethodTest.h" />
|
<ClInclude Include="src\ActiveMethodTest.h" />
|
||||||
<ClInclude Include="src\ActivityTest.h" />
|
<ClInclude Include="src\ActivityTest.h" />
|
||||||
<ClInclude Include="src\ConditionTest.h" />
|
<ClInclude Include="src\ConditionTest.h" />
|
||||||
|
<ClInclude Include="src\MutexTest.h" />
|
||||||
<ClInclude Include="src\RWLockTest.h" />
|
<ClInclude Include="src\RWLockTest.h" />
|
||||||
<ClInclude Include="src\SemaphoreTest.h" />
|
<ClInclude Include="src\SemaphoreTest.h" />
|
||||||
<ClInclude Include="src\ThreadingTestSuite.h" />
|
<ClInclude Include="src\ThreadingTestSuite.h" />
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<ClCompile Include="src\ConditionTest.cpp">
|
<ClCompile Include="src\ConditionTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\MutexTest.cpp">
|
||||||
|
<Filter>Threading\Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="src\RWLockTest.cpp">
|
<ClCompile Include="src\RWLockTest.cpp">
|
||||||
<Filter>Threading\Source Files</Filter>
|
<Filter>Threading\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -749,6 +752,9 @@
|
|||||||
<ClInclude Include="src\ConditionTest.h">
|
<ClInclude Include="src\ConditionTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\MutexTest.h">
|
||||||
|
<Filter>Threading\Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="src\RWLockTest.h">
|
<ClInclude Include="src\RWLockTest.h">
|
||||||
<Filter>Threading\Header Files</Filter>
|
<Filter>Threading\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -1023,6 +1023,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.cpp"
|
RelativePath=".\src\ConditionTest.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.cpp"
|
RelativePath=".\src\RWLockTest.cpp"
|
||||||
>
|
>
|
||||||
@@ -1071,6 +1075,10 @@
|
|||||||
RelativePath=".\src\ConditionTest.h"
|
RelativePath=".\src\ConditionTest.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\MutexTest.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\RWLockTest.h"
|
RelativePath=".\src\RWLockTest.h"
|
||||||
>
|
>
|
||||||
|
|||||||
122
Foundation/testsuite/src/MutexTest.cpp
Normal file
122
Foundation/testsuite/src/MutexTest.cpp
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
//
|
||||||
|
// MutexTest.cpp
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/testsuite/src/MutexTest.cpp#1 $
|
||||||
|
//
|
||||||
|
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include "MutexTest.h"
|
||||||
|
#include "CppUnit/TestCaller.h"
|
||||||
|
#include "CppUnit/TestSuite.h"
|
||||||
|
#include "Poco/Exception.h"
|
||||||
|
#include "Poco/Mutex.h"
|
||||||
|
#include "Poco/Runnable.h"
|
||||||
|
#include "Poco/Thread.h"
|
||||||
|
#include "Poco/Timestamp.h"
|
||||||
|
|
||||||
|
|
||||||
|
using Poco::FastMutex;
|
||||||
|
using Poco::Runnable;
|
||||||
|
using Poco::SystemException;
|
||||||
|
using Poco::Thread;
|
||||||
|
using Poco::Timestamp;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class SelfDeadlockRunnable: public Runnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SelfDeadlockRunnable():
|
||||||
|
_ran(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FastMutex mtx;
|
||||||
|
mtx.lock();
|
||||||
|
mtx.lock();
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
_ran = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ran() const
|
||||||
|
{
|
||||||
|
return _ran;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _ran;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MutexTest::MutexTest(const std::string& name): CppUnit::TestCase(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MutexTest::~MutexTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MutexTest::testFastMutexRecursion()
|
||||||
|
{
|
||||||
|
FastMutex mtx;
|
||||||
|
mtx.lock();
|
||||||
|
|
||||||
|
bool success = mtx.tryLock();
|
||||||
|
assert (!success);
|
||||||
|
|
||||||
|
Timestamp mark;
|
||||||
|
success = mtx.tryLock(2000); // Wait 2 seconds
|
||||||
|
assert (!success);
|
||||||
|
|
||||||
|
// Test that we waited approx. 2 sec
|
||||||
|
Timestamp::TimeDiff elapsed = mark.elapsed();
|
||||||
|
assert (elapsed > 1000000);
|
||||||
|
assert (elapsed < 3000000);
|
||||||
|
|
||||||
|
success = mtx.tryLock(0);
|
||||||
|
assert (!success);
|
||||||
|
|
||||||
|
SelfDeadlockRunnable r;
|
||||||
|
Thread t;
|
||||||
|
|
||||||
|
t.start(r);
|
||||||
|
success = t.tryJoin(2000);
|
||||||
|
assert (!success);
|
||||||
|
assert (!r.ran());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MutexTest::setUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MutexTest::tearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CppUnit::Test* MutexTest::suite()
|
||||||
|
{
|
||||||
|
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("MutexTest");
|
||||||
|
|
||||||
|
CppUnit_addTest(pSuite, MutexTest, testFastMutexRecursion);
|
||||||
|
|
||||||
|
return pSuite;
|
||||||
|
}
|
||||||
40
Foundation/testsuite/src/MutexTest.h
Normal file
40
Foundation/testsuite/src/MutexTest.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// MutexTest.h
|
||||||
|
//
|
||||||
|
// $Id: //poco/1.4/Foundation/testsuite/src/MutexTest.h#1 $
|
||||||
|
//
|
||||||
|
// Definition of the MutexTest class.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MutexTest_INCLUDED
|
||||||
|
#define MutexTest_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
#include "CppUnit/TestCase.h"
|
||||||
|
|
||||||
|
|
||||||
|
class MutexTest: public CppUnit::TestCase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MutexTest(const std::string& name);
|
||||||
|
~MutexTest();
|
||||||
|
|
||||||
|
void testFastMutexRecursion();
|
||||||
|
|
||||||
|
void setUp();
|
||||||
|
void tearDown();
|
||||||
|
|
||||||
|
static CppUnit::Test* suite();
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MutexTest_INCLUDED
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "ThreadingTestSuite.h"
|
#include "ThreadingTestSuite.h"
|
||||||
#include "ThreadTest.h"
|
#include "ThreadTest.h"
|
||||||
|
#include "MutexTest.h"
|
||||||
#include "SemaphoreTest.h"
|
#include "SemaphoreTest.h"
|
||||||
#include "RWLockTest.h"
|
#include "RWLockTest.h"
|
||||||
#include "ThreadPoolTest.h"
|
#include "ThreadPoolTest.h"
|
||||||
@@ -28,6 +29,7 @@ CppUnit::Test* ThreadingTestSuite::suite()
|
|||||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ThreadingTestSuite");
|
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ThreadingTestSuite");
|
||||||
|
|
||||||
pSuite->addTest(ThreadTest::suite());
|
pSuite->addTest(ThreadTest::suite());
|
||||||
|
pSuite->addTest(MutexTest::suite());
|
||||||
pSuite->addTest(SemaphoreTest::suite());
|
pSuite->addTest(SemaphoreTest::suite());
|
||||||
pSuite->addTest(RWLockTest::suite());
|
pSuite->addTest(RWLockTest::suite());
|
||||||
pSuite->addTest(ThreadPoolTest::suite());
|
pSuite->addTest(ThreadPoolTest::suite());
|
||||||
|
|||||||
Reference in New Issue
Block a user