Re: Is ROOT threadsafe?

From: Konstantin Olchanski <olchansk_at_triumf.ca>
Date: Wed, 2 Feb 2011 11:48:48 -0800


On Wed, Feb 02, 2011 at 10:26:37AM +0100, Fons Rademakers wrote:
> >so what's the current situation?
>
> Alas, not much has changed in the respect. The biggest issue is that CINT
> and X11 are not thread safe.

So by luck, I think I do nothing that touches CINT and X11 - hmm... but object serialization must go through CINT-generated code, with luck in might be threadsafe (does not use global variables and static arrays for data buffers).

> If you look in the code you will see statements like:
> R__LOCKGUARD2(gCollectionMutex);
> ... search for R__LOCKGUARD in the ROOT sources...

Good pointed, thanks.

> >So what locking do I need to do in my thread?
>
> Typically I would protect FindObject() in the case another threads could
> delete the found object in the meanwhile.

Right, but if I lock FindObject() but the main thread does not, that does me no good, however, I can grep for R__LOCKGUARD to find out what locking is actually present in the main thread.

I think this gives me enough to work with...

-- 
Konstantin Olchanski
Data Acquisition Systems: The Bytes Must Flow!
Email: olchansk-at-triumf-dot-ca
Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, Canada
Received on Wed Feb 02 2011 - 20:48:54 CET

This archive was generated by hypermail 2.2.0 : Wed Feb 02 2011 - 23:50:01 CET