Hi Erich, Use `yield` in place of `sync`. Using `yield` will wait for the thread to complete in the same way as `sync`, but it will dispatch GUI events while waiting.
Matthew At Wed, 31 Aug 2016 18:10:17 +0100, Erich Rast wrote: > Hi! > > I have a problem with the interplay between the racket GUI main thread > and other threads. My application connects to a socket and creates a > GUI. Some of the GUI events are sent over the socket, and everything is > highly asynchronous -- there are multiple threads and channels between > them for socket i/o. Moreover, GUI elements are also created from the > connection thread based on incoming network data. > > The problem is this: If I run my application manually within DrRacket as > > (thread > (lambda () > (connect))) > > It works fine. All events are triggered in the GUI, data is received, > event responses are sent over the network, etc. However, as a > standalone executable, the application will immediately quit, killing > the above connection thread. > > If I launch the application like this > > (define (start) > (void > (sync > (thread > (lambda () > (connect)))))) > > (start) > > then the application will launch fine as a standalone executable, but > no GUI events are being processed. GUI elements are displayed, but user > interaction (enter text, mouse-clicks, button press) have no effect. > > Basically, I need to wait until the connection thread ends, before the > application should quit, but at the same time the waiting may not > block any processing of GUI events like mouse-clicks. > > How can I achieve this? > > Best, > > Erich > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.