Re: [Vala] Thread unsafe GObject?



Hi,

On Thu, 2010-10-21 at 18:33 +0000, gerhard gruber documatrix com wrote:
to solve the problem i have rewritten the gobject library so it
increments the value of static_fundamental_next in function
"g_type_fundamental_next" with a write-lock around it.
but wouldn't it be better if vala locks the line
              <class_name>_type_id = g_type_register_fundamental
(g_type_fundamental_next (), "<ClassName>", &g_define_type_info,
&g_define_type_fundamental_info, 0);
in order to guarantee that object orientation is thread safe in vala?

I don't see how Vala could safeguard this properly with unmodified GLib.
Do you have a more specific suggestion how this would work?

You should probably better file a GLib bug for this issue.

Possible workarounds are to not define fundamental types (e.g., always
derive from GLib.Object) or to make sure that all types are initialized
in the main thread before starting new threads.

Jürg




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