Explicitly Constructing Functors and Runnables
In the following code segment, a functor and threaded runnable instance are explicitly constructed:
Example 2 – Constructing a threaded runnable from a functor
// Construct a functor that invokes hello
RWTFunctor<void()> myFunctor = hello; // 1
// Construct a runnable that invokes functor
RWThreadFunction myThread; // 2
myThread = RWThreadFunction::make(myFunctor); // 3
The code creates a threaded runnable that, when started, launches a thread that invokes the functor instance to execute the hello() function.