how to use set_threadsafe



Hi,
I'm looking at the thread_usage example from the latest
gtk+-2.8.7 and the perl GTK2-1.111 and I'm already
stymied. :-)

The thread_usage example provided works fine, but
the example is an object-oriented one, and it differs
from the one from earlier versions, which was more
of a functional style.

Anyways..... I have an example which was working under
the older libraries I had, and wanted to see how far I could
"push" the thread-safety capabilities.

So my first step was just to ue the standard init statements
used in the example.

So I put the lines in the script below and the die statement
causes a non-fatal warning:

use Gtk2 qw/-init -threads-init/;
die "Glib::Object thread safetly failed"
        unless Glib::Object->set_threadsafe (TRUE);

The warning I get is:
GLib-CRITICAL **: g_hash_table_foreach: assertion `hash_table != NULL' failed
at ./basic-thread-test line 23.

If I comment out the die statement, I don't get the error.

The script runs fine either way. So what is set_threadsafe complaining
about?
Also, if anyone can give tips on how far the thread-safety mechanism
can be pushed, it would be appreciated. Can you directly access widgets
in the main thread from a worker thread?

Thanks.



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

Attachment: basic-thread-test
Description: Binary data



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