Event driven thread programming
Hi. I'm fairly new to c++ so bear with me ;)
What i'm trying to code is an event driven register/dispatch system for dealing with incomming data from a socket. I have got the sockets bit figured out, but the next step is giving me a headache.
I want a registration method which invokes a new thread for each registered event and loops while checking for new data. When data corresponding to that event arrives it should send it to this thread whose loop will pick up the data from a queue and deal with it accordingly.
I was wondering if it was possible to pass a pointer to a function, which could then be executed when its corresponding event occurs. Or if not, does anyone know of a thread-safe framework for acheiving this kind of event driven program?