added start() method that takes a Poco::SharedPtr to a Runnable

This commit is contained in:
Günter Obiltschnig
2019-02-23 13:46:54 -05:00
parent e3e8c3474b
commit b961ea8148
2 changed files with 47 additions and 34 deletions

View File

@@ -144,6 +144,12 @@ public:
/// valid during the entire lifetime of the thread, as
/// only a reference to it is stored internally.
void start(Poco::SharedPtr<Runnable> pTarget);
/// Starts the thread with the given target.
///
/// The Thread ensures that the given target stays
/// alive while the thread is running.
void start(Callable target, void* pData = 0);
/// Starts the thread with the given target and parameter.

View File

@@ -38,6 +38,7 @@ namespace Poco {
namespace {
class RunnableHolder: public Runnable
{
public:
@@ -129,6 +130,12 @@ void Thread::start(Runnable& target)
}
void Thread::start(Poco::SharedPtr<Runnable> pTarget)
{
startImpl(pTarget);
}
void Thread::start(Callable target, void* pData)
{
startImpl(new CallableHolder(target, pData));