mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
improved Lambda support
This commit is contained in:
@@ -154,12 +154,19 @@ public:
|
||||
/// Starts the thread with the given target and parameter.
|
||||
|
||||
template <class Functor>
|
||||
void startFunc(Functor fn)
|
||||
void startFunc(const Functor& fn)
|
||||
/// Starts the thread with the given functor object or lambda.
|
||||
{
|
||||
startImpl(new FunctorRunnable<Functor>(fn));
|
||||
}
|
||||
|
||||
template <class Functor>
|
||||
void startFunc(Functor&& fn)
|
||||
/// Starts the thread with the given functor object or lambda.
|
||||
{
|
||||
startImpl(new FunctorRunnable<Functor>(std::move(fn)));
|
||||
}
|
||||
|
||||
void join();
|
||||
/// Waits until the thread completes execution.
|
||||
/// If multiple threads try to join the same
|
||||
@@ -242,6 +249,11 @@ protected:
|
||||
{
|
||||
}
|
||||
|
||||
FunctorRunnable(Functor&& functor):
|
||||
_functor(std::move(functor))
|
||||
{
|
||||
}
|
||||
|
||||
~FunctorRunnable()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user