Re: forked process exiting before output read




On Jul 30, 2007, at 6:29 AM, zentara wrote:

On Mon, 30 Jul 2007 07:55:44 +0200
"Jeffrey Ratcliffe" <jeffrey ratcliffe gmail com> wrote:

On 29/07/07, Jeffrey Ratcliffe <jeffrey ratcliffe gmail com> wrote:
That is an interesting idea I hadn't thought of. When I try it
(ThreadDemo4.pl), I get

GLib-CRITICAL **: g_hash_table_foreach: assertion `hash_table != NULL'
failed at ./ThreadDemo4.pl line 23.

on launching the app. But it almost works! On hitting the start
button, it gets to 75% and then locks.

That last bit was not enough sleep. Now it works, but still gets the
GLib-CRITICAL error on launch, which I have no idea about.

I've seen that numerous times myself..... the solution is to
comment out the line

 #Glib::Object->set_threadsafe (TRUE);

Only the muppet-master probably knows why commenting it out works.
I have no clue. :-)

The hash_table in question is the perl_gobjects table which is used to track the gobjects created by your program. This message comes out when Glib::Object::CLONE(), invoked by perl when the thread is created, attempts to increment the reference count of every Glib::Object that currently exists --- but no Glib::Objects have been created yet, so the perl_gobjects hash table has not yet been created.

Commenting out the set_threadsafe() line disables the object tracking, so you don't attempt to go in there.

Since the code does not create any Glib::Objects before the thread is spawned, the objects that *are* created are visible only to one thread, and therefore there are no spectacular fireworks when the second thread to die discovers that the first thread already killed the object.

While one possible answer is that everything is working just fine, i think it prudent that Glib::Object::CLONE() should verify that perl_gobjects exists before trying to call g_hash_table_foreach() on it.

--
me, while driving the car: Okay, girls, what do you want for lunch?
yvonne: I wan' noo-tulls!
zella: I want lavaloli!  Can we go to the lavaloli store?
me: Um, where *is* the ravioli store?
zella: At the lavaloli store!
yvonne: I want noo-tulls!  Let's go to the noo-tull store!




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