Skip to content

Commit

Permalink
use unordered_map
Browse files Browse the repository at this point in the history
  • Loading branch information
artpaul committed Sep 7, 2021
1 parent 3532508 commit cf948c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@

namespace acto {
namespace core {
namespace {

/** Контекс потока */
struct binding_context_t {
// Список актеров ассоциированных
// только с текущим потоком
std::set<object_t*> actors;
std::unordered_set<object_t*> actors;
// Счетчик инициализаций
std::atomic<long> 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<binding_context_t> thread_context{nullptr};

} // namespace

runtime_t::runtime_t()
: m_scheduler(&runtime_t::execute, this)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include "worker.h"

#include <atomic>
#include <set>
#include <thread>
#include <unordered_set>

namespace acto {
namespace core {
Expand All @@ -14,7 +14,7 @@ namespace core {
* Данные среды выполнения
*/
class runtime_t : public worker_t::callbacks {
using actors_set = std::set<object_t*>;
using actors_set = std::unordered_set<object_t*>;

// Максимальное кол-во рабочих потоков в системе
static constexpr unsigned int MAX_WORKERS = 512;
Expand Down

0 comments on commit cf948c7

Please sign in to comment.