-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Root Lockguard #9294
Copy link
Copy link
Closed
Labels
Description
- Checked for duplicates
Describe the bug
I've been using in my programs these constructs:
TMutex myMutex;
//...
R__LOCKGUARD(myMutex)
(In analogy with https://en.cppreference.com/w/cpp/thread/lock_guard)
Somehow, in one of my computers (not in the other, not sure if it is related with an update I did in ROOT or something similar), I get a compilation error. This error didn't appear before.
error: no matching function for call to ‘TLockGuard::TLockGuard(TMutex&)’
R__LOCKGUARD(fGuiMutex) // scoped mutex
^
/opt/root_src/core/base/inc/TVirtualMutex.h:76:4: note: candidate: TLockGuard::TLockGuard(TVirtualMutex*)
TLockGuard(TVirtualMutex *mutex)
^~~~~~~~~~
/opt/root_src/core/base/inc/TVirtualMutex.h:76:4: note: no known conversion for argument 1 from ‘TMutex’ to ‘TVirtualMutex*’
error: expected ‘,’ or ‘;’ before
72:4: note: candidate constructor not viable: no known conversion from 'TMutex' to 'const TLockGuard' for 1st argument
Expected behavior
No error is produced as before.
Or why are the others compiling well ?
Should I change instead to R__LOCKGUARD(&myMutex); ?
If yes, could this be added into the documentation ? Right now, it is not specified if it has to be a pointer or not.
To reproduce
- Open a ROOT terminal
- TMutex fr
- R__LOCKGUARD(fr)
Setup
------------------------------------------------------------------
| Welcome to ROOT 6.25/01 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Jul 08 2021, 11:17:13 |
| From heads/master@v6-25-01-1584-g068c20d159 |
| With c++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
Reactions are currently unavailable