summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/src/examples/cpp11/executors
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/src/examples/cpp11/executors')
-rw-r--r--3rdparty/asio/src/examples/cpp11/executors/bank_account_1.cpp9
-rw-r--r--3rdparty/asio/src/examples/cpp11/executors/bank_account_2.cpp12
-rw-r--r--3rdparty/asio/src/examples/cpp11/executors/fork_join.cpp7
3 files changed, 9 insertions, 19 deletions
diff --git a/3rdparty/asio/src/examples/cpp11/executors/bank_account_1.cpp b/3rdparty/asio/src/examples/cpp11/executors/bank_account_1.cpp
index abfd16a7ee0..a63d7fc059b 100644
--- a/3rdparty/asio/src/examples/cpp11/executors/bank_account_1.cpp
+++ b/3rdparty/asio/src/examples/cpp11/executors/bank_account_1.cpp
@@ -16,8 +16,7 @@ class bank_account
public:
void deposit(int amount)
{
- execution::execute(
- pool_.executor(),
+ pool_.executor().execute(
[this, amount]
{
balance_ += amount;
@@ -26,8 +25,7 @@ public:
void withdraw(int amount)
{
- execution::execute(
- pool_.executor(),
+ pool_.executor().execute(
[this, amount]
{
if (balance_ >= amount)
@@ -37,8 +35,7 @@ public:
void print_balance() const
{
- execution::execute(
- pool_.executor(),
+ pool_.executor().execute(
[this]
{
std::cout << "balance = " << balance_ << "\n";
diff --git a/3rdparty/asio/src/examples/cpp11/executors/bank_account_2.cpp b/3rdparty/asio/src/examples/cpp11/executors/bank_account_2.cpp
index 305d0ca5b86..45a24abc352 100644
--- a/3rdparty/asio/src/examples/cpp11/executors/bank_account_2.cpp
+++ b/3rdparty/asio/src/examples/cpp11/executors/bank_account_2.cpp
@@ -16,9 +16,7 @@ class bank_account
public:
void deposit(int amount)
{
- execution::execute(
- asio::require(pool_.executor(),
- execution::blocking.always),
+ asio::require(pool_.executor(), execution::blocking.always).execute(
[this, amount]
{
balance_ += amount;
@@ -27,9 +25,7 @@ public:
void withdraw(int amount)
{
- execution::execute(
- asio::require(pool_.executor(),
- execution::blocking.always),
+ asio::require(pool_.executor(), execution::blocking.always).execute(
[this, amount]
{
if (balance_ >= amount)
@@ -40,9 +36,7 @@ public:
int balance() const
{
int result = 0;
- execution::execute(
- asio::require(pool_.executor(),
- execution::blocking.always),
+ asio::require(pool_.executor(), execution::blocking.always).execute(
[this, &result]
{
result = balance_;
diff --git a/3rdparty/asio/src/examples/cpp11/executors/fork_join.cpp b/3rdparty/asio/src/examples/cpp11/executors/fork_join.cpp
index a76437efad9..7e8a827356d 100644
--- a/3rdparty/asio/src/examples/cpp11/executors/fork_join.cpp
+++ b/3rdparty/asio/src/examples/cpp11/executors/fork_join.cpp
@@ -32,8 +32,7 @@ public:
// it is time to shut down, i.e. the use count is zero.
for (thread_count_ = 0; thread_count_ < thread_count; ++thread_count_)
{
- execution::execute(
- threads_.executor(),
+ threads_.executor().execute(
[this]
{
std::unique_lock<std::mutex> lock(mutex_);
@@ -252,8 +251,8 @@ void fork_join_sort(Iterator begin, Iterator end)
{
fork_executor fork(pool);
join_guard join(fork);
- execution::execute(fork, [=]{ fork_join_sort(begin, begin + n / 2); });
- execution::execute(fork, [=]{ fork_join_sort(begin + n / 2, end); });
+ fork.execute([=]{ fork_join_sort(begin, begin + n / 2); });
+ fork.execute([=]{ fork_join_sort(begin + n / 2, end); });
}
std::inplace_merge(begin, begin + n / 2, end);
}