载入中...
搜索中...
未找到
Thread.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "common/Module.h"
6#include "common/AsyncWork.h"
7#include "thread/Channel.h"
8#include "thread/JobSystem.h"
9#include "thread/Task.h"
10#include "thread/ThreadPool.h"
11
12#include <map>
13#include <memory>
14#include <mutex>
15#include <string>
16
17namespace eve {
18namespace thread {
19
25public:
27
29 Thread();
31 ~Thread() override;
32
34 int getHardwareConcurrency() const;
35
41 ThreadPool *getPool();
42
48 ThreadPool *newThreadPool(int workerCount = 0);
49
57 JobSystem *getJobSystem();
58
66 Channel *getChannel(std::string channelName);
67
73 Channel *newChannel();
74
79 void postMain(std::string eventName, std::string data = "");
80
81private:
82 std::mutex mu_;
83 std::unique_ptr<ThreadPool> defaultPool_;
84 std::unique_ptr<JobSystem> defaultJobSystem_;
85 std::unique_ptr<eve::caps::IAsyncWorkExecutor> executor_;
86 std::map<std::string, std::unique_ptr<Channel>> namedChannels_;
87};
88
89} // namespace thread
90} // namespace eve
Capability for submitting CPU work onto a worker pool.
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
EVENGINE_API_FOUNDATION public API.
Definition Module.h:46
Thread-safe message queue (love2d-style Channel). Values are strings so the API stays overload-free f...
Definition Channel.h:19
Abstract job scheduler: dependencies, parallel_for, task_group, arena.
Definition JobSystem.h:157
Fixed-size worker pool. Owns worker std::threads; tasks run FIFO. Squirrel VM is not thread-safe — do...
Definition ThreadPool.h:26
Thread module: default pool, named channels, pool factory. Script: eve.Thread() → getPool / newThread...
Definition Thread.h:24
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16