[th/g-object-priv] add private data to GObject and use per-object locking
-
add a GObjectPrivate data (via
g_type_add_instance_private()
). -
use it for the "optional_flags" on archs that don't have
HAVE_OPTIONAL_FLAGS
. -
convert mutexes to bitlocks in private data.
The first problem is, it doesn't actually work. Tests don't pass. Unclear why. TODO. (FIXED)
The second problem is, (FIXED: we can reuse the g_bit_lock()
seems only to support one bit per integer (doc). Maybe that limitation could be fixed, but as it is, each mutex requires one gint
per GObject. Which is too bad, since we have plenty of unused bits in optional_flags
.gint
, as long as we are careful not to toggle any flags while holding a bitlock. In particular, we must not take a lock while holding another lock (of these kinds) and cannot change option_flags
while holding a bitlock).
WDYT?