SWT and network / socket data? [message #465098] |
Tue, 06 December 2005 00:39  |
Eclipse User |
|
|
|
I have an SWT program that displays a Label. Whenever the user selects a
menu item, I want to display something in that label. Also, the program
is listening for data on a Socket. Whenever network data arrives, I want
to display it in the Label.
So I've got two Threads. One is running the SWT main loop:
while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();
The other is reading and processing data from the network socket.
I don't think it's a good idea (or at all legal) for the second
Thread to ever call label.setText(). I want to funnel all SWT calls
through a single thread. Is there a way to do this, or, better
yet, is there a "right" way to do this? (Is there a way for the network
thread to add events to the end of the queue so that the SWT thread will
get to them in their turn? Or a way for the network thread to
wake-up the SWT thread?)
Thanks.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03015 seconds