Hi, I guess the simplest solution would be to use a IupTimer (on the main thread) and a mutex-condition pair, Inside the timer callback you check for a flag, for instance. But that check must be protected (lock+check+unlock), also the flag updated from the other thread must be protected too (lock+update+unlock). Not the best solution, but a a simple one that works fine.
Best, Scuri On Tue, Oct 6, 2015 at 9:04 AM, "Jörg F. Wittenberger" < joerg.wittenber...@softeyes.net> wrote: > Am 06.10.2015 um 12:25 schrieb Ranier VF: > > Hi,Well, your implementation must be:one consumer (GUI thread)many > producers (GUI events) > > You can use mutex-condition pair (classic), sockets or a new way pipes. > > As I understand Andys question he wants to know how to unblock the GUI > thread while it is waiting in IupMainLoop. Correct? > > That's actually I problem I have as well. My work around is to use > IupFlush instead of the main loop. But that's a bit against Antonios > suggestions. > > Best > /Jörg > > > > Best,Ranier Vilela > > > >> From: supp...@scriptbasic.org > >> To: iup-users@lists.sourceforge.net > >> Date: Mon, 5 Oct 2015 22:17:15 -0700 > >> Subject: Re: [Iup-users] Is Iup pthread safe? > >> > >> Andy, > >> > >> I feel if you follow what I have done in Script BASIC for threaded IUP > >> it should work for you without any changes to anything. > >> > >> John > >> > >> On Tue, 2015-10-06 at 15:54 +1100, Andy Xiyue wrote: > >>> Thanks John and Ranier. > >>> > >>> > >>> At least I'm confirmed now I can not update the attributions of IUP > >>> controls in other threads so my previous programming module was > >>> definitely wrong. > >>> > >>> So the question becomes how to send the control update event to the > >>> main thread? > >>> > >>> > >>> It's quite obvious the main thread is stuck in IupMainLoop(). Most > >>> events can be processed in this main thread, like buttons, text, etc. > >>> When users click the button, or inside the text input entry, the IUP > >>> generates the event and it will be processed in IupMainLoop(). > >>> However, how an external thread send the event into the main thread? I > >>> can't use message queue or semaphore because IupMainLoop() takes all > >>> the control. Are there some functions used for inserting IUP events? > >>> > >>> > >>> Kind regards > >>> > >>> Andy > >>> > >>> > ------------------------------------------------------------------------------ > >>> _______________________________________________ > >>> Iup-users mailing list > >>> Iup-users@lists.sourceforge.net > >>> https://lists.sourceforge.net/lists/listinfo/iup-users > >> > >> > >> > >> > ------------------------------------------------------------------------------ > >> _______________________________________________ > >> Iup-users mailing list > >> Iup-users@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/iup-users > > > > > > > > > > > ------------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > Iup-users mailing list > > Iup-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/iup-users > > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users > >
------------------------------------------------------------------------------
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users