Re: plea for review



Hi Tim,

> tricky case:
> 
> thread1: g_type_init()  // acquires write lock
> thread2: g_type_init()  // wait, lock held by thread1
> thread1: do basic field setups
> thread1: release write lock
> thread2: acquire wirte lock
> thread2: find out g_type_init() has already been caled, return
> thread1: do some more type initialization, but not all yet
> thread2: call some function that relies on the type system being
>          fully initialized (which thread1 hasn't finished yet) => boom
> 
> there're two scenarios:
> 1) people call g_type_init() and then start individual threads - fine
> 2) people start several threads that call g_type_init() on their own
> 
> for (2), the above "tricky" scenario could occour, so the intend of that
> extra g_type_init lock is to block other g_type_init() callers until
> the first one completed intialization.

Yeah, you're right.

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi




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