data from the main/GUI thread to another runnin thread...
it has been a long, long time since i have done java work, and even longer since i have done threading work in java, so i am a little rusty, and after a few hours of research and tinkering, i can't seem to figure something out (this would be easy with pointers...).
basically, i am writing some software that has a C based background process, but with a Java front end (don't ask why. an existing code-base made it a necessity). the java GUI is extremely simple; basically just drop down boxes, in which the values were being written to text files and picked up by the C. now we are going to get rid of the text files and go with sockets.
basically, the java only needs 2 threads. the GUI thread and then the thread running the socket stuff. the socket thread is running as a server, and the C will be running as a client. this is how it had to work because this is basically an extension to the C code, and it cannot spawn another thread, nor sit in a wait state forever.
all i need to know is how to continuously pass information from the GUi thread to the socket thread. basically, there are a few objects that the data resides in (the data that is being entered by the GUI), and i need to pass this stuff to the socket thread as it is updated (every time a drop down box is clicked, the updated data needs to go to the socket thread).
this is an interesting concept, considering the socket thread is in a "wait" state, meaning the line "Socket connectionSocket = myServerSocket.accept();" puts this thread in a "wait" state as is. so data in the socket thread isn't getting updated as it should; it is only getting updated when it receives another connection and finally gets out of that "wait" state.
anyone have any clues? if you had a Java Server running and in its "wait" state, how do you dynamically update information that it is supposed to send to the client?
thanks a ton for any help whatsoever.