R
Ralph Shnelvar
[Note: parts of this message were removed to make it a legal post.]
Background:
I am writing an FXRuby program. My question should be independent of FXRuby, though.
FXRuby is a GUI for Ruby.
If I understand some of the comments made here (and I probably don't) [see subject: interpreter cannot enter in the context from another thread] it is a bad thing to attempt to run an FXRuby function in a non-main thread.
So ... I have a non-main thread that wants to display a message box (i.e. "call" FXMessageBox").
How can I invoke FXMessageBox in the context of the main thread?
I can think of all sorts of ugly solutions.
For instance:
1) Set some global_variable indicating the task I want to perform in the main thread.
2) Do a thread.stop
3) have a timer in the main thread and have it dispatch based on global_variable
4) save the return code of FXMessageBox in a thread local variable the not-main-thread
5) Do a thread.run to wake up the stopped not-main-thread.
Ugly!
Background:
I am writing an FXRuby program. My question should be independent of FXRuby, though.
FXRuby is a GUI for Ruby.
If I understand some of the comments made here (and I probably don't) [see subject: interpreter cannot enter in the context from another thread] it is a bad thing to attempt to run an FXRuby function in a non-main thread.
So ... I have a non-main thread that wants to display a message box (i.e. "call" FXMessageBox").
How can I invoke FXMessageBox in the context of the main thread?
I can think of all sorts of ugly solutions.
For instance:
1) Set some global_variable indicating the task I want to perform in the main thread.
2) Do a thread.stop
3) have a timer in the main thread and have it dispatch based on global_variable
4) save the return code of FXMessageBox in a thread local variable the not-main-thread
5) Do a thread.run to wake up the stopped not-main-thread.
Ugly!