I'm using a POSIX timer to call a function that is defined with std::function template:
typedef std::function<void (union sigval)> functionCbType;
I get the following error in assignment to field sigev_notify_function of struct sigevent:
error: cannot convert ‘functionCbType {aka std::function}’ to ‘void ()(sigval_t) {aka void ()(sigval)}’ in assignment se.sigev_notify_function = callcbk;
functionCbType callcbk;
...
struct sigevent se;
se.sigev_notify = SIGEV_THREAD;
se.sigev_notify_function = callcbk;
se.sigev_notify_attributes = NULL;
int status = timer_create(CLOCK_MONOTONIC, &se, &timer_id);
se.sigev_notify_function expects
void (*sigev_notify_function) (union sigval);
What is the correct way to do this?