LeviLamina
Loading...
Searching...
No Matches
BackgroundWorker.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/container/MovePriorityQueue.h"
7#include "mc/deps/core/threading/BackgroundTaskBase.h"
8#include "mc/deps/core/threading/ITaskExecutionContext.h"
9#include "mc/deps/core/threading/SPSCQueue.h"
10
11// auto generated forward declare list
12// clang-format off
14class WorkerPool;
15namespace Bedrock::Threading { class OSThreadPriority; }
16// clang-format on
17
19public:
20 // BackgroundWorker inner types define
21 enum class RunOneResult : int {
22 NoTasks = 0,
23 TaskExecuted = 1,
24 Retry = 2,
25 };
26
27 enum class State : int {
28 Initializing = 0,
29 Off = 1,
30 Running = 2,
31 };
32
33public:
34 // member variables
35 // NOLINTBEGIN
51 // NOLINTEND
52
53public:
54 // prevent constructor by default
55 BackgroundWorker& operator=(BackgroundWorker const&);
58
59public:
60 // virtual functions
61 // NOLINTBEGIN
62 // vIndex: 0
63 virtual ~BackgroundWorker() /*override*/;
64
65 // vIndex: 1
66 virtual bool isAsync() const /*override*/;
67
68 // vIndex: 2
69 virtual bool canTaskRunAgain() const /*override*/;
70 // NOLINTEND
71
72public:
73 // member functions
74 // NOLINTBEGIN
75 MCAPI BackgroundWorker(
76 ::std::string name,
77 bool async,
79 ::std::optional<uint64> coreAffinity,
80 ::std::optional<int> idealCore,
81 ::WorkerPool& workerPool,
82 bool suppressProfiling
83 );
84
85 MCAPI void _doNoWorkDelay();
86
87 MCAPI bool _processNextTask();
88
89 MCAPI ::BackgroundWorker::RunOneResult _runOneTask();
90
91 MCAPI void queue(::std::shared_ptr<::BackgroundTaskBase> task);
92
93 MCAPI void start();
94 // NOLINTEND
95
96public:
97 // static variables
98 // NOLINTBEGIN
99 MCAPI static ::BackgroundWorker*& gLocalWorkerMappingSingleton();
100 // NOLINTEND
101
102public:
103 // constructor thunks
104 // NOLINTBEGIN
105 MCAPI void* $ctor(
106 ::std::string name,
107 bool async,
109 ::std::optional<uint64> coreAffinity,
110 ::std::optional<int> idealCore,
111 ::WorkerPool& workerPool,
112 bool suppressProfiling
113 );
114 // NOLINTEND
115
116public:
117 // destructor thunk
118 // NOLINTBEGIN
119 MCAPI void $dtor();
120 // NOLINTEND
121
122public:
123 // virtual function thunks
124 // NOLINTBEGIN
125 MCFOLD bool $isAsync() const;
126
127 MCAPI bool $canTaskRunAgain() const;
128 // NOLINTEND
129
130public:
131 // vftables
132 // NOLINTBEGIN
133 MCAPI static void** $vftable();
134 // NOLINTEND
135};
Definition BackgroundTaskBase.h:13
Definition BackgroundWorker.h:18
Definition OSThreadPriority.h:7
Definition ITaskExecutionContext.h:5
Definition WorkerPool.h:19
Definition Alias.h:14