Re: instance-private-data issue
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor redhat com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: instance-private-data issue
- Date: Thu, 7 Aug 2003 10:52:26 +0200 (CEST)
On 6 Aug 2003, Owen Taylor wrote:
> * For normal mutexes, static mutexes are more efficient than
> dynamically allocated mutexes and a lot easier to manage.
> That's why we use them in most places in GLib for locking
> global resources.
how can static mutexes be more efficient if:
#define g_static_mutex_lock(mutex) \
g_mutex_lock (g_static_mutex_get_mutex (mutex))
their implementation is based on normal dynamic mutex functions?
for some configurations, g_static_mutex_get_mutex() may even go through
a single glib-global lock used to protect all static mutexes.
as for being easier to manage, that boils down to:
G_LOCK_DEFINE_STATIC (type_lock);
vs:
static GMutex *type_lock;
init { type_lock = g_mutex_new (); }
which is no problem if you have an init function, here, g_type_init().
> Regards,
> Owen
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]