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
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&);
59
60public:
61 // virtual functions
62 // NOLINTBEGIN
63 // vIndex: 0
64 virtual ~BackgroundWorker() /*override*/;
65
66 // vIndex: 1
67 virtual bool isAsync() const /*override*/;
68
69 // vIndex: 2
70 virtual bool canTaskRunAgain() const /*override*/;
71 // NOLINTEND
72
73public:
74 // member functions
75 // NOLINTBEGIN
77 ::std::string name,
78 bool async,
80 ::std::optional<uint64> coreAffinity,
81 ::std::optional<int> idealCore,
82 ::WorkerPool& workerPool,
83 bool suppressProfiling
84 );
85
86 MCNAPI void _doNoWorkDelay();
87
88 MCNAPI bool _processNextTask(::RunTaskOptions const& options);
89
90 MCNAPI ::BackgroundWorker::RunOneResult _runOneTask(::RunTaskOptions const& options);
91
92 MCNAPI void queue(::std::shared_ptr<::BackgroundTaskBase> task);
93
94 MCNAPI void start();
95 // NOLINTEND
96
97public:
98 // static variables
99 // NOLINTBEGIN
100 MCNAPI static ::BackgroundWorker*& gLocalWorkerMappingSingleton();
101 // NOLINTEND
102
103public:
104 // constructor thunks
105 // NOLINTBEGIN
106 MCNAPI void* $ctor(
107 ::std::string name,
108 bool async,
110 ::std::optional<uint64> coreAffinity,
111 ::std::optional<int> idealCore,
112 ::WorkerPool& workerPool,
113 bool suppressProfiling
114 );
115 // NOLINTEND
116
117public:
118 // destructor thunk
119 // NOLINTBEGIN
120 MCNAPI void $dtor();
121 // NOLINTEND
122
123public:
124 // virtual function thunks
125 // NOLINTBEGIN
126 MCNAPI bool $isAsync() const;
127
128 MCNAPI bool $canTaskRunAgain() const;
129 // NOLINTEND
130
131public:
132 // vftables
133 // NOLINTBEGIN
134 MCNAPI static void** $vftable();
135 // NOLINTEND
136};
Definition BackgroundTaskBase.h:13
Definition BackgroundWorker.h:19
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