mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 20:54:41 +03:00
fix CI, fix heading and add comment requested at today's editor's call
This commit is contained in:
@@ -15034,7 +15034,7 @@ which handles spawning or reusing a thread without exposing raw threads to your
|
|||||||
##### Note
|
##### Note
|
||||||
|
|
||||||
Unfortunately, `std::async` is not perfect. For example, it doesn't use a thread pool,
|
Unfortunately, `std::async` is not perfect. For example, it doesn't use a thread pool,
|
||||||
which means that it may fail due to resource exhaustion, rather than queueing up your tasks
|
which means that it may fail due to resource exhaustion, rather than queuing up your tasks
|
||||||
to be executed later. However, even if you cannot use `std::async`, you should prefer to
|
to be executed later. However, even if you cannot use `std::async`, you should prefer to
|
||||||
write your own `future`-returning factory function, rather than using raw promises.
|
write your own `future`-returning factory function, rather than using raw promises.
|
||||||
|
|
||||||
@@ -15050,7 +15050,7 @@ at avoiding raw `std::thread` management.
|
|||||||
std::thread t1([p1 = std::move(p1)]() mutable {
|
std::thread t1([p1 = std::move(p1)]() mutable {
|
||||||
p1.set_value(read_value("v1.txt"));
|
p1.set_value(read_value("v1.txt"));
|
||||||
});
|
});
|
||||||
t1.detach();
|
t1.detach(); // evil
|
||||||
|
|
||||||
std::packaged_task<int()> pt2(read_value, "v2.txt");
|
std::packaged_task<int()> pt2(read_value, "v2.txt");
|
||||||
std::future<int> f2 = pt2.get_future();
|
std::future<int> f2 = pt2.get_future();
|
||||||
@@ -19209,6 +19209,8 @@ or even an occasional "`string`s cannot be compared with `==`).
|
|||||||
|
|
||||||
The solution is to explicitly `#include <string>`:
|
The solution is to explicitly `#include <string>`:
|
||||||
|
|
||||||
|
##### Example, good
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|||||||
@@ -632,6 +632,7 @@ webby
|
|||||||
Webcolor
|
Webcolor
|
||||||
webcolors
|
webcolors
|
||||||
WG21
|
WG21
|
||||||
|
WorkQueue
|
||||||
'widen'
|
'widen'
|
||||||
x1
|
x1
|
||||||
x2
|
x2
|
||||||
|
|||||||
Reference in New Issue
Block a user