Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
On 2/17/2024 11:15 AM, Bonita Montero wrote:
Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
lock_guard is meant for its purpose. ...
Am 18.02.2024 um 00:40 schrieb Chris M. Thomasson:
On 2/17/2024 11:15 AM, Bonita Montero wrote:
Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
lock_guard is meant for its purpose. ...
You easily could do ...
˙˙˙˙template<typename Lock>
˙˙˙˙using std::lock_guard = std::unique_lock<Lock>;
... without any problems.
For me lock_guard doesn't make sense.
On 2/17/2024 10:59 PM, Bonita Montero wrote:
Am 18.02.2024 um 00:40 schrieb Chris M. Thomasson:
On 2/17/2024 11:15 AM, Bonita Montero wrote:
Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
lock_guard is meant for its purpose. ...
You easily could do ...
˙˙˙˙˙template<typename Lock>
˙˙˙˙˙using std::lock_guard = std::unique_lock<Lock>;
... without any problems.
For me lock_guard doesn't make sense.
It has its purpose. ...
Am 18.02.2024 um 21:13 schrieb Chris M. Thomasson:
On 2/17/2024 10:59 PM, Bonita Montero wrote:
Am 18.02.2024 um 00:40 schrieb Chris M. Thomasson:
On 2/17/2024 11:15 AM, Bonita Montero wrote:
Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
lock_guard is meant for its purpose. ...
You easily could do ...
˙˙˙˙˙template<typename Lock>
˙˙˙˙˙using std::lock_guard = std::unique_lock<Lock>;
... without any problems.
For me lock_guard doesn't make sense.
It has its purpose. ...
... which unique_lock also fulfills.
Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
On 02/17/24 11:15 AM, Bonita Montero wrote:
Why is there lock_guard when unique_lock can anything lock_guard
can do but far more ?
If you really want to ask about it, you should probably consider `scoped_lock` instead of `lock_guard` anyway. The rest can be found here
Sysop: | Tetrazocine |
---|---|
Location: | Melbourne, VIC, Australia |
Users: | 6 |
Nodes: | 8 (0 / 8) |
Uptime: | 19:04:50 |
Calls: | 45 |
Files: | 21,492 |
Messages: | 62,989 |