Re: next round: glib thread safety proposal



Hi, Owen

> > So, did I get it right: We will use the default implementation for
> > GStaticMutex, no matter what the user supplies in g_thread_init(), but
> > provide a fallback for systems without a default implementation, that
> > implements GStaticMutex by means of GMutex, as supplied with
> > g_thread_init()?
> 
> I guess my feeling is, that if the user supplies thread funcs,
> we _have_ to use them. If, say, the default mutexes are from
> a kernel threading package, and the supplied mutex from
> a a user space thread package - if a kernel mutex can't be
> claimed, instead of scheduling another user thread, it will
> either try to schedule another kernel thread, or possible
> error out because it detects a mutex recursion.

Ah, thats what my last solution did, thats why you need the runtime_mutex.
This mutex is used, whenever the default implementation is not chosen,
i.e. g_mutex_use_default_impl==FALSE. otherwise the default_mutex is used.

I'll post a new, only slightly changed patch today:
  
  glib-wilhelmi-981203-0.patch.*

This should (modulo my comment below) be quite close to what we want for
1.2, I think. I'm about to make more glib files thread safe

PS.: One problem we have is, that we can't rely on the mutexes being
recursive (they aren't here on solaris). To achive that, we would have to
have a function returning an integral value, that determines the current
thread and as that would require adding thread functions right now, it
wouldn't be good. But it can turn out to be quite difficult to make glib
thread safe without recursive mutexes, especially gmem.c.

Bye, 
Sebastian
-- 
+--------------============####################============--------------+
| Sebastian Wilhelmi, Institute for Computer Design and Fault Tolerance, |
| University of Karlsruhe;  Building 20.20, Room 263,  D-76128 Karlsruhe |
| mail: wilhelmi@ira.uka.de;  fax: +49 721 370455;  fon: +49 721 6084353 |
+-----------------> http://goethe.ira.uka.de/~wilhelmi <-----------------+



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