Re: GType and GObject Thread save?
- From: Tristan Van Berkom <vantr touchtunes com>
- To: Pedro Ortega <peortega dcc uchile cl>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GType and GObject Thread save?
- Date: Wed, 05 Mar 2003 10:54:49 -0500
They are not thread safe "by themselves"
you want to do simething like this:
GMutex *mtx = g_mutex_new();
g_object_set_data(object, "object_mutex", mtx);
before using them. AFAIK g_object_get_data is
reentrant; so as long as each
thread holds a reference to the object
(making sure it will still exist) a thread
may access it like so:
GMutex *mtx = g_object_get_data(object, "object_mutex");
g_mutex_lock(mtx);
/*
manipulate object
*/
g_mutex_unlock(mtx);
Cheers,
-Tristan
Pedro Ortega wrote:
Hi,
I would like to code a little server that builds GObjects
from XML. So my question is, are GType and GObject thread
save? I would rather prefer to handle every call in a
separate thread instead of forking/executing everithing.
Thanks
Piter
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]