From 17fe8a957fd47397d502113918db992348f6707e Mon Sep 17 00:00:00 2001 From: luav Date: Mon, 16 Oct 2017 12:08:21 +0200 Subject: [PATCH] Manual non-async task removed --- CppCoreGuidelines.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index d8e7d74..d89e52b 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -13400,18 +13400,10 @@ Application concepts are easier to reason about. // ... } - void manual_publishing(std::string* msg) - { - // Encapsulates thread functionality into the application task - std::thread publisher(publish, &msg); - publisher.join(); - } - void some_fun() { std::string msg; - std::thread publisher(publish, &msg); // bad (less expressive and more error-prone) - auto pubtask = std::sync(publish, &msg); // OK - manual_publishing(&msg); // OK (manually crafted task) + std::thread publisher(publish, &msg); // bad (less expressive and more error-prone) + auto pubtask = std::async(publish, &msg); // OK // ... publisher.join(); }