载入中...
搜索中...
未找到
Task.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <condition_variable>
6#include <functional>
7#include <memory>
8#include <mutex>
9#include <string>
10
11namespace eve {
12namespace thread {
13
19public:
21 explicit Task(std::function<void()> fn);
24
26 std::string getStatus() const;
28 bool isDone() const;
30 bool hasFailed() const;
32 std::string getError() const;
33
35 void wait();
36
37 // Internal — called by ThreadPool workers.
39 void run();
40
41private:
42 struct State {
44 explicit State(std::function<void()> taskFn) : fn(std::move(taskFn)) {}
45
47 std::function<void()> fn;
48 mutable std::mutex mu;
49 std::condition_variable cv;
50 std::string status = "pending";
51 std::string error;
52 };
53
54 explicit Task(std::shared_ptr<State> state);
55 static void run(const std::shared_ptr<State> &state);
56
57 std::shared_ptr<State> state_;
58
59 friend class ThreadPool;
60};
61
62} // namespace thread
63} // namespace eve
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
wgpu::PopErrorScopeStatus status
std::weak_ptr< Run > run
Definition OnnxGpgpu.cpp:25
std::string error
Definition Package.cpp:60
A job executed by a ThreadPool worker. Status strings (no enums): "pending" | "running" | "done" | "f...
Definition Task.h:18
Fixed-size worker pool. Owns worker std::threads; tasks run FIFO. Squirrel VM is not thread-safe — do...
Definition ThreadPool.h:26
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
SettlementPipeline::Stage fn
std::mutex mu
Definition Graphics.cpp:181