Skip to content

Commit

Permalink
Update vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Oct 15, 2023
1 parent 2d9faaa commit 701b668
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

// pqrs::dispatcher v2.11
// pqrs::dispatcher v2.12

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

#include "dispatcher/dispatcher.hpp"
#include "dispatcher/object_id.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::dispatcher` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::extra::dispatcher_client` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::extra::shared_dispatcher` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::extra::timer` can be used safely in a multi-threaded environment.

#include "dispatcher_client.hpp"
#include <atomic>

namespace pqrs {
namespace dispatcher {
Expand All @@ -23,7 +24,8 @@ class timer final {
public:
timer(dispatcher_client& dispatcher_client) : dispatcher_client_(dispatcher_client),
current_function_id_(0),
interval_(0) {
interval_(0),
enabled_(false) {
}

~timer(void) {
Expand All @@ -35,6 +37,8 @@ class timer final {

void start(std::function<void(void)> function,
duration interval) {
enabled_ = true;

dispatcher_client_.enqueue_to_dispatcher([this, function, interval] {
++current_function_id_;
function_ = function;
Expand All @@ -45,13 +49,19 @@ class timer final {
}

void stop(void) {
enabled_ = false;

dispatcher_client_.enqueue_to_dispatcher([this] {
++current_function_id_;
function_ = nullptr;
interval_ = duration(0);
});
}

bool enabled(void) const {
return enabled_;
}

private:
// This method is executed in the dispatcher thread.
void call_function(int function_id) {
Expand Down Expand Up @@ -80,6 +90,8 @@ class timer final {
int current_function_id_;
std::function<void(void)> function_;
duration interval_;

std::atomic<bool> enabled_;
};
} // namespace extra
} // namespace dispatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::object_id` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::hardware_time_source` can be used safely in a multi-threaded environment.
// `pqrs::dispatcher::pseudo_time_source` can be used safely in a multi-threaded environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

#include <chrono>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

// pqrs::dispatcher v2.11
// pqrs::dispatcher v2.12

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

#include "dispatcher/dispatcher.hpp"
#include "dispatcher/object_id.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::dispatcher` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::extra::dispatcher_client` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::extra::shared_dispatcher` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::extra::timer` can be used safely in a multi-threaded environment.

#include "dispatcher_client.hpp"
#include <atomic>

namespace pqrs {
namespace dispatcher {
Expand All @@ -23,7 +24,8 @@ class timer final {
public:
timer(dispatcher_client& dispatcher_client) : dispatcher_client_(dispatcher_client),
current_function_id_(0),
interval_(0) {
interval_(0),
enabled_(false) {
}

~timer(void) {
Expand All @@ -35,6 +37,8 @@ class timer final {

void start(std::function<void(void)> function,
duration interval) {
enabled_ = true;

dispatcher_client_.enqueue_to_dispatcher([this, function, interval] {
++current_function_id_;
function_ = function;
Expand All @@ -45,13 +49,19 @@ class timer final {
}

void stop(void) {
enabled_ = false;

dispatcher_client_.enqueue_to_dispatcher([this] {
++current_function_id_;
function_ = nullptr;
interval_ = duration(0);
});
}

bool enabled(void) const {
return enabled_;
}

private:
// This method is executed in the dispatcher thread.
void call_function(int function_id) {
Expand Down Expand Up @@ -80,6 +90,8 @@ class timer final {
int current_function_id_;
std::function<void(void)> function_;
duration interval_;

std::atomic<bool> enabled_;
};
} // namespace extra
} // namespace dispatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::object_id` can be used safely in a multi-threaded environment.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

// `pqrs::dispatcher::hardware_time_source` can be used safely in a multi-threaded environment.
// `pqrs::dispatcher::pseudo_time_source` can be used safely in a multi-threaded environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// (C) Copyright Takayama Fumihiko 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
// (See https://www.boost.org/LICENSE_1_0.txt)

#include <chrono>

Expand Down

0 comments on commit 701b668

Please sign in to comment.