Guys,
I have a problem which takes me 2 days to solve so far, hope you may help me.
I have posted a thread before about it but unfortunately the problem is still there!!
-----
the problem is simply "I do not know what is the correct syntax if I want to call a function in POSIX thread create which has an argument which is pointer to function".
I really have no idea, I almost check all of possible syntaxes but they do not work...
The errors I received are basically because of the syntax faults. (mostly concerning the "invalid conversion from ....")
Thanks,
Amir.
I have a problem which takes me 2 days to solve so far, hope you may help me.
I have posted a thread before about it but unfortunately the problem is still there!!
-----
the problem is simply "I do not know what is the correct syntax if I want to call a function in POSIX thread create which has an argument which is pointer to function".
Code:
class EventInterface {
public:
EventInterface(void (*ptToFunc)(Event *, int));
.....
static void * receiveEvent (void (*onMessageFunc)(Event *, int));
}
EventInterface::EventInterface(void (*ptToFunc)(char *, int)){
pthread_create( &receiveThread, NULL, EventInterface::receiveEvent, (void *) (*ptToFunc)) ?????
....
}
void EventInterface::receiveEvent(void (*onMessageFunc)(Event *, int)){
.....
onMessageFunc(notifiedEvent , subscriptionID);
}
The errors I received are basically because of the syntax faults. (mostly concerning the "invalid conversion from ....")
Thanks,
Amir.
Comment