I've fixed the gnome-metadata thread-safety change to work with glib
1.2.  Sorry about that.  The new change just locks a mutex around the
body of each exported function.  This is a poor implementation, but it
is easy to understand and verify.  It works because (as of my change)
the exported functions are never called from inside the module (ok,
this is ugly).  A fine-grained implementation is a real pain without
recursive mutexes.

It is possible to implement a recursive mutex in terms of an ordinary
mutex and a condition variable, provided you can get the current
thread id.  However, glib doesn't provide any way to do that either.
I could have done it using thread-private data, but that seemed like
too much work for something we'll just reimplement anyway (plus the
accumulation of ugliness along that path swamped me).

gnome-mime also needs to be made thread-safe.  gnome-metadata calls
gnome-mime, and both these are used by the new VFS, which uses

Thread-safety for the gnome-libs in general would be nice to have.
Better would be to modules thread-safe by design (when appropriate).
I think this is something we should adopt as a rule for new modules,
and then gradually change old ones to conform.


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