Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about stdmutex

Read more about stdmutex

python (65.2k questions)

javascript (44.3k questions)

reactjs (22.7k questions)

java (20.8k questions)

c# (17.4k questions)

html (16.3k questions)

r (13.7k questions)

android (13k questions)

Questions - stdmutex

RAII: do mutexes in a vector declared in a loop all unlock in the next iteration?

Suppose I have the following: // ... necessary includes class X { struct wrapper{ std::mutex mut{}; } std::array<wrapper, 20> wrappers{}; void Y() { for (auto i{0u}; i...
test-img

SRSR333

c++

mutex

raii

stdmutex

Votes: 0

Answers: 1

Latest Answer

To answer my own question—yes, this is how RAII works. The vector is declared inside the body of the for loop; it is destroyed and recreated every iteration. continue also causes the execution of the ...
test-img

SRSR333

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved