Re: problems with Glib::Thread



Hi,

Maybe we should put this on the gtkmm homepage in fontsize 35 ;-)
Unless it's me getting old i've seen this particular question 5 times on
the list last month :P

>From the FAQ:
-----------------------------------------------------------
Is gtkmm thread-safe?

Paul Davis wrote:

Neither X, nor GDK nor GTK+ nor gtkmm are thread safe by themselves. You
must use either the gdk_threads_{enter,leave}() functions to protect any
and every call to GDK/GTK+/gtkmm functions, or alternatively, ensure
that only a single thread makes such calls. One common way to do this is
to have non-GUI threads send requests to the GUI thread via a pipe. The
pipe is hooked into the main glib event loop used by GTK.

Personally, i have always used the single-threaded approach, which I
find much more suitable for my apps.

Note that glibmm comes with Glib::Dispatcher, which implements a cross-
thread signal using the pipe approach described above.
------------------------------------------------------------------------

See also
http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1Dispatcher.html

cheers,

Bart

On Sun, 2004-10-31 at 19:07 +0100, Ultrakorne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> i have problems insert text in a textview from a thread...
> it sometimes freeze the gui and one time crashed with that error:
> 
> 
> The program 'client' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadLength (poly request too large or internal Xlib length
> erro'.
> ~  (Details: serial 1589 error_code 16 request_code 157 minor_code 20)
> ~  (Note to programmers: normally, X errors are reported asynchronously;
> ~   that is, you will receive the error a while after causing it.
> ~   To debug your program, run it with the --sync command line
> ~   option to change this behavior. You can then get a meaningful
> ~   backtrace from your debugger if you break on the gdk_x_error()
> function.)
> 
> 
> the textview is used only by that thread... and the application have
> only 1 thread ( of course the default one running the gui...)
> 
> the function runned by the thread only insert some text... 1-2 or 3
> times the text is inserted correcly, then it freeze...
> thx for any help
> - --
> +--------------------+-------------------------------------+
> |    Metal OWNZ U    |        GnuPG ID: E2844BB9           |
> |   icq#: 61252311   | My Public key at: wwwkeys.pgp.net   |
> +--------------------+-------------------------------------+
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFBhSnhzMLB4uKES7kRAl+zAJsFNBFoGY0C4K+gioBOJx0Fqimi4gCdEF6E
> FG08NeBKs/4HaiS70/Z1pQs=
> =egYp
> -----END PGP SIGNATURE-----
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
www.titanium-it.nl --- Open Minded Open Source
www.real-life.nl <-----Another Source




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]