mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
- fixed PS build script environment vars generation
- fixed MongoDB 64-bit std::size_t warnings - added Thread::trySleep()/wakeUp() and tests
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/Thread.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -50,4 +51,16 @@ Runnable::~Runnable()
|
||||
}
|
||||
|
||||
|
||||
void Runnable::sleep(long milliseconds)
|
||||
{
|
||||
Thread::sleep(milliseconds);
|
||||
}
|
||||
|
||||
|
||||
void Runnable::trySleep(long milliseconds)
|
||||
{
|
||||
Thread::current()->trySleep(milliseconds);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
@@ -62,6 +62,7 @@ Thread::Thread():
|
||||
_name(makeName()),
|
||||
_pTLS(0)
|
||||
{
|
||||
_event.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +71,7 @@ Thread::Thread(const std::string& name):
|
||||
_name(name),
|
||||
_pTLS(0)
|
||||
{
|
||||
_event.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +124,18 @@ bool Thread::tryJoin(long milliseconds)
|
||||
}
|
||||
|
||||
|
||||
void Thread::trySleep(long milliseconds)
|
||||
{
|
||||
_event.tryWait(milliseconds);
|
||||
_event.reset();
|
||||
}
|
||||
|
||||
void Thread::wakeUp()
|
||||
{
|
||||
_event.set();
|
||||
}
|
||||
|
||||
|
||||
ThreadLocalStorage& Thread::tls()
|
||||
{
|
||||
if (!_pTLS)
|
||||
|
||||
Reference in New Issue
Block a user