Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need lock_guard for JGlobalRootLock #125

Open
faustus123 opened this issue Jul 28, 2022 · 4 comments
Open

Need lock_guard for JGlobalRootLock #125

faustus123 opened this issue Jul 28, 2022 · 4 comments

Comments

@faustus123
Copy link
Collaborator

It would be great to have the equivalent to a lock_guard for the JGlobalRootLock service. Probably need two, a read and a write. Could we implement something that would support something like:

auto lck = m_lock->LockGuardWrite();

@DraTeots
Copy link
Collaborator

DraTeots commented Jul 29, 2022

BTW how JGlobalRootLock relates to ROOT EnableThreadSafety()
which enables global lock also. Could it be moved on root? Or it is too uncontrollable?

P.S. A bit more on it from ROOT docs

@faustus123
Copy link
Collaborator Author

I think the primary use case of modifying TTree and TH* objects will still require our own lock according to the documentation you point to. Those objects are considered "conditionally" thread safe, but since we are typically filling them from multiple threads, they will need to be synchronized.

@nathanwbrei
Copy link
Collaborator

C++ adds a read-write mutex/lock guard called std::shared_mutex/lock. The catch is that it is C++17, so I doubt it will work on gcc4.8.5.

@DraTeots
Copy link
Collaborator

DraTeots commented Aug 6, 2022

And 4.8.5 is a requirement for Gluex/JLab? As EIC soft is on C++17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants