Convenience macro to simplify bounce statement usage.
The BOUNCE() macro simplifies the creation of a bounce function to a class member for use with C-style callbacks. The BOUNCE() macro must be paried with a this pointer to get to the proper class instance.
Example usage with a C-style callback interface.
posixThread is a C++ class, and posixThread::thread_func() is a member function which we want to pass to pthread_create().
r = pthread_create(&handle_, &attributes,
reinterpret_cast<void* (*)(
void*)
>(
BOUNCE(posixThread, thread_func)),
reinterpret_cast<void*>(this));
- Parameters
-
| c | The class type. |
| m | The member function in the class |
- Returns
- A bounce function which redirects a C-style callback to a class member function.