Hi.
The fun with multithreaded network programming and wxPython continues.
Currently, to capture incoming events, I'm using a derivation of the async-threaded-wxPython server that was posted last week .
For sending events, I was originally using modal dialogs w/ blocking sockets, and life was good but clunky. But now, I've moved to using threads so that multiple 'send' dialogs can be invoked at the same time and concurrent incoming events will still show up as icons in the main gui.
what this means in terms of pseudo-code is something like this:
Main class (the main interface):
Send(self)
send_dialog = wxDialog(yadda, yadda)
thread_instance = Net_Thread(Function, argument = send_dialog)
thread_instance.start()
Function(self, send_dialog)
val = send_dialog.ShowModal()
if val == wxID_OK:
send the message()
else:
pass
Send() basically instantiates a thread, and applies the function to the arguments provided.
What I end up getting is a dialog box that is blank and impossible to destroy without killing the app, and the following error messages:
Xlib: unexpected async reply (sequence *some val*)
Xlib: sequence lost (0x10000) > 0x3b18) in
So far, my searches on the web as to "what the hell does that mean" have turned up the following bit of info:
???
I get this message every once and then... It means that you are making two X
calls (or gtk calls) at the same time, without protecting your stuff... Your
program should start by calling:
g_thread_init(NULL);
Your gtk_main() should be:
gdk_thread_enver();
gtk_main();
gdk_thread_leave();
and you should also protect all gtk calls that aren't in the main thread with
the gdk_thread_enter/gdk_thread_leave calls.
???
suggestions? (other than moving to using processes )
-Steve