Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rwtMakeRunnableCallback()

Module:  Threads   Package:  Threading


Global Functions and Macros

Local Index

Members

Non-Members

Header File

#include <rw/thread/rwtMakeRunnableCallback.h>

Description

The rwtMakeRunnableCallback() helper functions and macros create functors that may be passed to the addCallback() method of an RWRunnableHandle. The functor may be created from functions that accept a constant RWRunnable reference as first argument, and an RWExecutionState as second argument, and that do not return a value.

rwtMakeRunnableCallback() comes in two flavors. First, there is a set of overloaded global function templates. Since not all compilers are able to handle templates to the degree required by these functions, we also provide a corresponding set of macros. The template functions are slightly easier to use and you only have to remember one name. The macros are more portable but they do require more arguments; and as we cannot overload macros, each must have a unique name.

In naming the macros we have employed a convention to make the names easier to remember. Each name begins with rwtMakeRunnableCallback(), which will be followed by either a G if the macro is expecting a global function, or an M if it is expecting a member function. At that point, the name is complete, if the associated global or member function takes no additional arguments. Otherwise we add one of A1 or A2, for functions with 1 or 2 additional arguments respectively. For example, you will use macro rwtMakeRunnableCallbackG() to create a runnable that calls a global function that takes no arguments other than the runnable reference and the execution state. The macro rwtMakeRunnableCallbackMA2() will create a runnable that calls a member function that takes four arguments: the runnable reference and the execution state, plus two user-supplied arguments.

Example Using Templates

Example Using Macros

Global Function Templates

RWTFunctor2<const RWRunnable&,RWExecutionState>
rwtMakeRunnableCallback(void (*function)(const  RWRunnable&,
                       RWExecutionState))
template <class A1, class AA1>
RWTFunctor2<const RWRunnable&,RWExecutionState>
rwtMakeRunnableCallback(void (*function)(const RWRunnable&,
                       RWExecutionState,A1), AA1 a1)
template <class A1, class A2, class AA1, class AA2>
RWTFunctor2<const RWRunnable&,RWExecutionState>
rwtMakeRunnableCallback((void (*function) (const  RWRunnable&,
                       RWExecutionState,A1,A2), AA1 a1,AA2 a2)
template <class Callee>
RWTFunctor2<const RWRunnable&,RWExecutionState>
rwtMakeRunnableCallback(Callee& callee,void
(Callee::*function)(const RWRunnable&,RWExecutionState))
template <class Callee, class A1, class AA1>
RWTFunctor2<const RWRunnable&,RWExecutionState>
rwtMakeRunnableCallback(Callee& callee,
void (Callee::*function)
(const RWRunnable&,RWExecutionState,A1), AA1 a1)
template <class Callee, class A1, class A2, 
class AA1, class AA2> RWTFunctor2<const RWRunnable&,RWExecutionState> rwtMakeRunnableCallback(Callee& callee,
void (Callee::*function)
(const RWRunnable&,RWExecutionState,A1,A2), AA1 a1, AA2 a2)

Macros (for Use With Global Functions)

The macros in this section use the following naming conventions for the macro arguments:

rwtMakeRunnableCallbackG(function)
rwtMakeRunnableCallbackGA1(function,A1,a1)
rwtMakeRunnableCallbackGA2(function,A1,a1,A2,a2)

Macros (for Use With Member Functions)

The macros in this section use the following naming conventions for the macro arguments:

rwtMakeRunnableCallbackM(Callee,callee,function) 
rwtMakeRunnableCallbackMA1(Callee,callee,function,A1,a1) 
rwtMakeRunnableCallbackMA2(Callee,callee,function,A1,a1,
A2,a2)

See Also

RWRunnableHandle, RWTFunctor2



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.