mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
fix parens
This commit is contained in:
parent
6a8728a054
commit
12bdb63b06
|
@ -11527,8 +11527,8 @@ Thread creation is expensive.
|
||||||
|
|
||||||
void master(istream& is)
|
void master(istream& is)
|
||||||
{
|
{
|
||||||
for (Message m; is>>m; )
|
for (Message m; is >> m; )
|
||||||
run_list.push_back(new thread(worker,m);}
|
run_list.push_back(new thread(worker, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
This spawns a `thread` per message, and the `run_list` is presumably managed to destroy those tasks once they are finished.
|
This spawns a `thread` per message, and the `run_list` is presumably managed to destroy those tasks once they are finished.
|
||||||
|
@ -11913,9 +11913,9 @@ Double-checked locking is easy to mess up.
|
||||||
|
|
||||||
atomic<bool> x_init;
|
atomic<bool> x_init;
|
||||||
|
|
||||||
if (!x_init.load(memory_order_acquire) {
|
if (!x_init.load(memory_order_acquire)) {
|
||||||
lock_guard<mutex> lck(x_mutex);
|
lock_guard<mutex> lck(x_mutex);
|
||||||
if (!x_init.load(memory_order_relaxed) {
|
if (!x_init.load(memory_order_relaxed)) {
|
||||||
// ... initialize x ...
|
// ... initialize x ...
|
||||||
x_init.store(true, memory_order_release);
|
x_init.store(true, memory_order_release);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user