Re: next round: glib thread safety proposal



Owen Taylor wrote:
> 
> 
> Jeff Garzik <jgarzik@pobox.com> writes:
> 
> > > Thats what thread specific
> > > data means. you have a global key, shared by all threads and if you query
> > > with that key, every thread gets its own data location. that is kind of a
> > > resemblence of static vars, only with the obviuos advantage, that every
> > > thread has its own.
> > 
> > Can you give me a concrete example of where this would be useful?
> > If each thread needs its own data location, I g_malloc it.  If each
> > thread needs access to a global structure, I wrap it in a mutex.
> 
> One place where thread-specific data comes in useful is making
> old API's thread safe.

Libs typically need more thread-specific data than apps.  errno is a
good example, as is your recent post.

	Jeff





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