Re: [gtk-list] Re: Strange quirk
- From: Rich Neitzel <thor atd ucar edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Strange quirk
- Date: Fri, 06 Nov 1998 08:58:34 -0700
In message <199811041813.NAA00797@pretzel.normnet.org> Jeff Garzik
wrote:
>Rich Neitzel wrote:
>>
>> I'm seeing a strange quirk in behavior. The setup is:
>>
>> gtk 1.0.6
>> gtk-- 0.9.20 Both compiled with -D_REENTRANT -O2.
>>
>> RedHat 5.1
>>
>> The program needs to input data. If this is done via gdk_input_add(),
>> everything works fine. However, if the input is done in a separate
>> thread, any entry based object will fail in g_mem_chunk_alloc() as
>> soon as a key is pressed.
>
>Can you give more detail as to what "program needs to input data" and
>"if input is done in a separate thread" really mean?
The program needs to get radar data and I have tried 2 methods -
reading from a fifo or using a message queue to pass a pointer to a
location in shared memory. In the monolithic version I have only tried
reading from a fifo & this works fine. In the threaded version, I have
tried both reading from a fifo & waiting on a message queue. Both work
well, inputting the data & drawing fine. All the UI parts of the
program (buttons, grabbing mouse clicks, etc.) work fine except for
entries.
>What exactly is the thread doing?
An infinite loop - wait on either a read() call for the fifo case or a
msgrcv() call for the queue case, then massage & draw the data.
>Does it make any g_*, gdk_*, or gtk_* calls?
>If so, what functions does the thread call?
No g_* calls are made directly, but many gdk & gtk calls are made,
such as gdk_draw_[point/line/polygon](), gdk_window_copy_area(),
gdk_gc_set_foreground(), etc.
>Was Glib compiled with _REENTRANT also?
Sorry, I thought was implied in saying gtk 1.0.6 was, since gtk, gdk &
glib use the same set of CFLAGS.
I should also mention that I call XInitThreads() as the 1st action in
main(). Further, I have tried calling XLockDisplay()/XUnlockDisplay()
before/after calling any gtk/gdk functions in the drawing thread. I
have also tried not using them, but the results are the same.
Further, there is no need to have data flowing to cause the
problem. Pressing any key in an entry at any point results in all
threads blocking.
Richard Neitzel thor@atd.ucar.edu Torren med sitt skjegg
National Center For Atmospheric Research lokkar borni under sole-vegg
Box 3000 Boulder, CO 80307-3000 Gjø'i med sitt shinn
303-497-2057 jagar borni inn.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]