I want to make a simple GUI API. Essentially the way it will work is the gui widget is basically a thread in an infinite loop. The thread has a pointer to the widget's class. The way I want it to work is basically similar to WinAPI. I would do something like this:
textbox->SendMessage("Click",args);
which is then added to its queue for processing. Eventually this will call a pointed function which would be the click event handler. Another thing I want to be able to do is safely get and set stuff in the class, without having to worry if the worker thread is using it. For example, if I send a message (which adds to a queue) while the worker is dequeing this might cause trouble. I'm using boost::thread. What exactly should I do for my situation?
Thanks