[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trouble: GTK + Octave + PThreads
From: |
John W. Eaton |
Subject: |
Re: Trouble: GTK + Octave + PThreads |
Date: |
Thu, 5 Nov 1998 09:47:09 -0600 (CST) |
On 5-Nov-1998, Rafael Laboissiere <address@hidden> wrote:
| [gtk-list people: if this thread is becoming too Octave-specific, please
| tell me and I will remove the gtk-list address from the Cc: list.]
I removed gtk-list because I'm not a subscriber (and don't want to
become one) so I can't post there anyway.
| With GTK+ (as with other X-based GUI toolkits) it is necessary to launch
| a main loop (gtk_main, for instance) which will take care of the mouse
| events. As my application will be launched from the Octave prompt, it
| gets blocked when gtk_main is called, unless I use threads.
|
| JWE> Can't you just use something like select() to decide where
| JWE> input is coming from?
|
| Yes, if my application would be taking care of the readline loop, which
| is not the case (Octave is doing it).
|
| JWE> With Tcl/Tk and some other X-based GUI toolkits, it is
| JWE> relatively easy to continue to get input from the readline
| JWE> prompt while also allowing the GUI objects to function.
|
| I am not sure, but I think that with Tcl/Tk, the function Tcl_Init
| spawns a whole new process, which communicate with the main program
| through Tcl_Eval. This is not the case of the application I am planning
| to write, as the GUI interface will be able to alter directly the
| workspace data of Octave.
The example Tcl/Tk code that I posted does not start a Tcl interpreter
in a separate process. It's been a while since I thought about this,
but I believe the way it works by registering a function with readline
that handles events (event_hook, which calls Tcl_DoOneEvent) and then
also by telling Tcl not to do anything with input on stdin, so that
readline will get that.
I believe the same approach works with other toolkits. In Xt, I think
the function to call to register the input function for stdin is
XtAppAddInput.
| JWE> What does -D_REENTRANT do for complinig Octave?
|
| I compiled version 2.0.13.91 with -D_REENTRANT. It works normally.
That doesn't answer my question. What is the purpose of -D_REENTRANT?
That symbol is not used in the Octave code. Adding it to the compiler
flags might have some effect on the functions declared in system
header files, but I don't think it will make the Octave code
reentrant.
jwe