From cf948c7a107b1ab81b2e79fe9e0051f35fbb2116 Mon Sep 17 00:00:00 2001 From: artpaul Date: Tue, 7 Sep 2021 17:47:53 +0500 Subject: [PATCH] use unordered_map --- lib/runtime.cpp | 8 ++++++-- lib/runtime.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/runtime.cpp b/lib/runtime.cpp index 6bb726a..2a3f781 100644 --- a/lib/runtime.cpp +++ b/lib/runtime.cpp @@ -4,21 +4,25 @@ namespace acto { namespace core { +namespace { /** Контекс потока */ struct binding_context_t { // Список актеров ассоциированных // только с текущим потоком - std::set actors; + std::unordered_set actors; // Счетчик инициализаций std::atomic counter; }; -/// Объект, от имени которого посылается сообщение +/// Pointer to the active actor is using to +/// implicitly determine a sender for a message. static thread_local object_t* active_actor{nullptr}; /// - static thread_local std::unique_ptr thread_context{nullptr}; +} // namespace + runtime_t::runtime_t() : m_scheduler(&runtime_t::execute, this) { diff --git a/lib/runtime.h b/lib/runtime.h index 2a7781b..b757102 100644 --- a/lib/runtime.h +++ b/lib/runtime.h @@ -4,8 +4,8 @@ #include "worker.h" #include -#include #include +#include namespace acto { namespace core { @@ -14,7 +14,7 @@ namespace core { * Данные среды выполнения */ class runtime_t : public worker_t::callbacks { - using actors_set = std::set; + using actors_set = std::unordered_set; // Максимальное кол-во рабочих потоков в системе static constexpr unsigned int MAX_WORKERS = 512;