Is this:
std::mutex mutex;
for () {
std::unique_lock<mutex> lock(mutex);
// do something
lock.unlock();
}
Equivalent to this in terms of releasing and acquiring the lock every iteration of the for loop?
std::mutex mutex;
for () {
std::unique_lock<mutex> lock(mutex);
// do something
}
Related questions: