Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
C++ invoker
Heres a rough idea, how you can use this with any function object:
template<class F>
struct invoker
static void start(void * x)
delete x;
template<class F>
int create(pthread_t *thread, const pthread_attr_t *attr, F f)
return pthread_create(thread, attr, &invoker<F>::start, (void *) new F(f));
It allocates the function object on to the heap which may not be the best option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.