[Iup-users] Firing an event from another thread
Brought to you by:
scuri
From: Ross B. <Ross@CheshireEng.com> - 2008-11-26 02:06:18
|
Hi, I am a happy user of IUP 2.6 via its Lua binding on Windows, and look forward to moving to 3.0 when it is ready. One feature I have been wishing for in IUP is a thread-safe way to fire an event in the GUI. This can be used by a worker thread to push a status change to the GUI, for example. As I currently understand IUP, the only available thread-safe mechanism is to create an iupTimer control and use it to poll for status changes from the main thread. In a pure Windows program, I would do this by defining a private windows message as WM_APP+n and subsequently call PostMessage() in the worker thread to drop that message on the app's message queue for dispatch in the main thread when discovered by the app's message loop. I assume that some similar facility exists in Motif and GTK, but I have no direct experience with those environments. To implement this idea, we need two things. The first is the ability to signal an event from any thread. The second is a way to catch the event in a callback at the application level. And, ideally, bindings for Lua that are compatible with as many of the popular threading implementations as possible. Of course, it is also possible that I've missed something obvious that already provides this capability... Ross Berteig Ross@CheshireEng.com Cheshire Engineering Corp. http://www.CheshireEng.com/ |