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;
15struct RunTaskOptions;
16namespace Bedrock::Threading { class OSThreadPriority; }
17// clang-format on
18
19class BackgroundWorker : public ::ITaskExecutionContext {
20public:
21 // BackgroundWorker inner types define
22 enum class RunOneResult : int {
23 NoTasks = 0,
24 TaskExecuted = 1,
25 Retry = 2,
26 };
27
28 enum class State : int {
29 Initializing = 0,
30 Off = 1,
31 Running = 2,
32 };
33
34public:
35 // member variables
36 // NOLINTBEGIN
52 // NOLINTEND
53
54public:
55 // prevent constructor by default
56 BackgroundWorker& operator=(BackgroundWorker const&);
57 BackgroundWorker(BackgroundWorker const&);
58 BackgroundWorker();
59
60public:
61 // virtual functions
62 // NOLINTBEGIN
63 virtual ~BackgroundWorker() /*override*/;
64
65 virtual bool isAsync() const /*override*/;
66
67 virtual bool canTaskRunAgain() const /*override*/;
68 // NOLINTEND
69
70public:
71 // member functions
72 // NOLINTBEGIN
74 ::std::string name,
75 bool async,
77 ::std::optional<uint64> coreAffinity,
78 ::std::optional<int> idealCore,
79 ::WorkerPool& workerPool,
80 bool suppressProfiling
81 );
82
83 MCNAPI void _doNoWorkDelay();
84
85 MCNAPI bool _processNextTask(::RunTaskOptions const& options);
86
87 MCNAPI ::BackgroundWorker::RunOneResult _runOneTask(::RunTaskOptions const& options);
88
89 MCNAPI void queue(::std::shared_ptr<::BackgroundTaskBase> task);
90
91 MCNAPI void start();
92 // NOLINTEND
93
94public:
95 // static variables
96 // NOLINTBEGIN
97 MCNAPI static ::BackgroundWorker*& gLocalWorkerMappingSingleton();
98 // NOLINTEND
99
100public:
101 // constructor thunks
102 // NOLINTBEGIN
103 MCNAPI void* $ctor(
104 ::std::string name,
105 bool async,
107 ::std::optional<uint64> coreAffinity,
108 ::std::optional<int> idealCore,
109 ::WorkerPool& workerPool,
110 bool suppressProfiling
111 );
112 // NOLINTEND
113
114public:
115 // destructor thunk
116 // NOLINTBEGIN
117 MCNAPI void $dtor();
118 // NOLINTEND
119
120public:
121 // virtual function thunks
122 // NOLINTBEGIN
123 MCNAPI bool $isAsync() const;
124
125 MCNAPI bool $canTaskRunAgain() const;
126
127
128 // NOLINTEND
129
130public:
131 // vftables
132 // NOLINTBEGIN
133 MCNAPI static void** $vftable();
134 // NOLINTEND
135};
Definition BackgroundTaskBase.h:13
MCAPI bool $isAsync() const
MCAPI::BackgroundWorker::RunOneResult _runOneTask(::RunTaskOptions const &options)
MCAPI bool $canTaskRunAgain() const
static MCAPI ::BackgroundWorker *& gLocalWorkerMappingSingleton()
MCAPI void start()
MCAPI void queue(::std::shared_ptr<::BackgroundTaskBase > task)
MCAPI void $dtor()
MCAPI BackgroundWorker(::std::string name, bool async, ::Bedrock::Threading::OSThreadPriority const &priority, ::std::optional< uint64 > coreAffinity, ::std::optional< int > idealCore, ::WorkerPool &workerPool, bool suppressProfiling)
MCAPI bool _processNextTask(::RunTaskOptions const &options)
static MCAPI void ** $vftable()
MCAPI void * $ctor(::std::string name, bool async, ::Bedrock::Threading::OSThreadPriority const &priority, ::std::optional< uint64 > coreAffinity, ::std::optional< int > idealCore, ::WorkerPool &workerPool, bool suppressProfiling)
MCAPI void _doNoWorkDelay()
Definition OSThreadPriority.h:7
Definition ITaskExecutionContext.h:5
Definition WorkerPool.h:19
Definition RunTaskOptions.h:5
Definition Alias.h:14