Re: Is g_log threadsafe?



On Mon, 25 Jun 2001, Szymon Polom wrote:

> Hello,
> 
> i like the GLIB logging facility :).
> 
> While being in a multithreaded application environment I get something like:
> 
> conDVD(pid:25505conDVD (pid:25507): LIBCIMDECODERSPU-DEBUG (recursed):
> write_spu start.
> aborting...
> 
> I assume that g_log is not threadsafe.

g_log itself is thread safe (or at least supposed to be so, modulo bugs ;)
but if you attach your own handler you have to make sure it locks all
strucutres properly that might be used concurrently (even for the same
handler being run at the same time from different threads).

the "(recursed)" part above indicates that g_log() was called from within
a handler of g_log() within the same thread. usually that shouldn't happen
so we're aborting here.

> 
> Is it intended to be so? If yes, I guess i would have to install handlers
> with a locking mechanism.
> 
> A reply will oblige :).
> 
> Bye... SP.

---
ciaoTJ






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