LeviLamina
Loading...
Searching...
No Matches
TaskGroup.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/PathBuffer.h"
7#include "mc/deps/core/http/StatusCode.h"
8#include "mc/deps/core/threading/Async.h"
9#include "mc/deps/core/threading/IBackgroundTaskOwner.h"
10#include "mc/deps/core/threading/SharedAsync.h"
11#include "mc/deps/core/utility/NonOwnerPointer.h"
12#include "mc/deps/nether_net/ESessionError.h"
13#include "mc/editor/services/playtest/SessionResult.h"
14#include "mc/network/services/signaling/ISignalingServiceConfigProvider.h"
15#include "mc/platform/ErrorInfo.h"
16#include "mc/platform/Result.h"
17#include "mc/platform/brstd/move_only_function.h"
18#include "mc/platform/brstd/promise.h"
19#include "mc/platform/threading/Mutex.h"
20#include "mc/platform/threading/UniqueLock.h"
21#include "mc/resources/TaskGroupState.h"
22#include "mc/server/commands/edu/make_code_fileio/MakeCodeFileResult.h"
23#include "mc/world/level/FileArchiver.h"
24
25// auto generated forward declare list
26// clang-format off
28class Pack;
29class ResourcePack;
30class Scheduler;
31class TaskResult;
32class WatchdogTimer;
33class WorkerPool;
35struct AsyncJoinAllow;
36struct AsyncJoinDeny;
40struct TaskStartInfo;
41namespace Bedrock::Http { class HeaderCollection; }
42namespace Bedrock::Http { class Request; }
43namespace Bedrock::Http { class Response; }
44namespace Bedrock::Http { struct Url; }
45namespace Bedrock::Services { struct AzureGetTokenHttpResponse; }
46namespace Bedrock::Services { struct EnvironmentQueryResponse; }
47namespace Bedrock::Threading { struct CachedAsyncRetry; }
48namespace Json { class Value; }
49namespace JsonRpc { class JsonRpcError; }
50namespace JsonRpc { class TurnConfigResult; }
51namespace MakeCodeFileIO { struct MakeCodeFileIOReadResult; }
52namespace PackCommand { struct CommandExecutor; }
53namespace PackCommand { struct PackCommandResult; }
54namespace RepositoryLoading { struct PackModifications; }
55// clang-format on
56
57class TaskGroup : public ::IBackgroundTaskOwner {
58public:
59 // TaskGroup inner types declare
60 // clang-format off
61 template<typename... T0> struct TaskTraitsBase;
62 template<typename... T0> struct TaskTraitsImpl;
63 template<typename T0> class ThenableBase;
64 // clang-format on
65
66 // TaskGroup inner types define
67 template <typename... T0>
68 struct TaskTraitsBase {};
69
70 template <typename... T0>
71 struct TaskTraitsImpl {};
72
73 template <typename T0>
74 class ThenableBase {};
75
76public:
77 // member variables
78 // NOLINTBEGIN
79 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::Scheduler>> mScheduler;
80 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::WorkerPool>> mWorkers;
81 ::ll::TypedStorage<8, 32, ::std::string> mName;
82 ::ll::TypedStorage<1, 1, bool> mCheckOwnerThread;
83 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mLock;
84 ::ll::TypedStorage<4, 4, ::std::atomic<::TaskGroupState>> mState;
85 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mTasks;
86 ::ll::TypedStorage<8, 8, uint64> mTaskCount;
87 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mEnumCurr;
88 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mEnumNext;
89 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mResumeTaskHandle;
90 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mResumeTaskMutex;
91 // NOLINTEND
92
93public:
94 // prevent constructor by default
95 TaskGroup();
96
97public:
98 // virtual functions
99 // NOLINTBEGIN
100 virtual ::Bedrock::Threading::Async<void> queue_DEPRECATED(
101 ::TaskStartInfo const& startInfo,
103 ::std::function<void()>&& callback
104 ) /*override*/;
105
106 virtual ::Bedrock::Threading::Async<void> queueSync_DEPRECATED(
107 ::TaskStartInfo const& startInfo,
109 ) /*override*/;
110
111 virtual ~TaskGroup() /*override*/;
112
113 virtual void taskRegister(::std::shared_ptr<::BackgroundTaskBase> task) /*override*/;
114
115 virtual void requeueTask(::std::shared_ptr<::BackgroundTaskBase> task, bool queueImmediate) /*override*/;
116
117 virtual ::TaskGroupState getState() const /*override*/;
118
119 virtual void processCoroutines() /*override*/;
120
121 virtual void taskComplete(::gsl::not_null<::BackgroundTaskBase*> task) /*override*/;
122
123 virtual bool _workerPoolIsAsync() const;
124 // NOLINTEND
125
126public:
127 // member functions
128 // NOLINTBEGIN
129 MCAPI TaskGroup(::WorkerPool& workers, ::Scheduler& context, ::std::string name);
130
131 MCAPI void _doWorkUntil(::Bedrock::Threading::SharedAsync<void> task, ::brstd::promise<void>* workStarted);
132
133 MCAPI void _forAllTasks(
134 ::Bedrock::Threading::UniqueLock<::Bedrock::Threading::Mutex>& lock,
135 ::std::function<void(::std::shared_ptr<::BackgroundTaskBase> const&)> callback
136 );
137
138 MCAPI ::gsl::not_null<::IBackgroundTaskOwner*> _getBackgroundTaskManager();
139
140 MCAPI void _queueInternal(::std::shared_ptr<::BackgroundTaskBase> bgtask);
141
142#ifdef LL_PLAT_C
143 MCAPI uint64 count() const;
144#endif
145
146 MCAPI void flush(::std::function<void()> waitFn);
147
148 MCAPI bool isEmpty() const;
149
150#ifdef LL_PLAT_C
151 MCAPI void kick(uint count);
152
153 MCAPI void resume();
154#endif
155
156 MCAPI void sync_DEPRECATED_ASK_TOMMO(::std::function<void()> waitFn);
157 // NOLINTEND
158
159public:
160 // static functions
161 // NOLINTBEGIN
162 MCAPI static ::IBackgroundTaskOwner* getCurrentTaskGroup();
163
164 MCAPI static ::Bedrock::Threading::Async<void> queueChild_DEPRECATED(
165 ::TaskStartInfo const& startInfo,
167 ::std::function<void()>&& callback
168 );
169 // NOLINTEND
170
171public:
172 // constructor thunks
173 // NOLINTBEGIN
174 MCAPI void* $ctor(::WorkerPool& workers, ::Scheduler& context, ::std::string name);
175 // NOLINTEND
176
177public:
178 // destructor thunk
179 // NOLINTBEGIN
180 MCAPI void $dtor();
181 // NOLINTEND
182
183public:
184 // virtual function thunks
185 // NOLINTBEGIN
186 MCAPI ::Bedrock::Threading::Async<void> $queue_DEPRECATED(
187 ::TaskStartInfo const& startInfo,
189 ::std::function<void()>&& callback
190 );
191
192 MCAPI ::Bedrock::Threading::Async<void>
193 $queueSync_DEPRECATED(::TaskStartInfo const& startInfo, ::brstd::move_only_function<::TaskResult()>&& task);
194
195 MCAPI void $taskRegister(::std::shared_ptr<::BackgroundTaskBase> task);
196
197 MCAPI void $requeueTask(::std::shared_ptr<::BackgroundTaskBase> task, bool queueImmediate);
198
199 MCFOLD ::TaskGroupState $getState() const;
200
201 MCAPI void $processCoroutines();
202
203 MCAPI void $taskComplete(::gsl::not_null<::BackgroundTaskBase*> task);
204
205 MCAPI bool $_workerPoolIsAsync() const;
206
207
208 // NOLINTEND
209
210public:
211 // vftables
212 // NOLINTBEGIN
213 MCNAPI static void** $vftable();
214 // NOLINTEND
215};
Definition BackgroundTaskBase.h:13
Definition HeaderCollection.h:7
Definition Request.h:16
Definition Response.h:7
Definition IBackgroundTaskOwner.h:17
Definition JsonRpcError.h:7
Definition TurnConfigResult.h:13
Definition Value.h:16
Definition Pack.h:27
Definition ResourcePack.h:21
Definition Scheduler.h:14
Definition TaskGroup.h:74
static MCAPI void ** $vftable()
Definition TaskResult.h:5
Definition WatchdogTimer.h:12
Definition WorkerPool.h:19
Definition WorldPacksHistoryFile.h:12
Definition move_only_function.h:9
STL namespace.
Definition AsyncJoinAllow.h:5
Definition AsyncJoinDeny.h:8
Definition Url.h:7
Definition AzureGetTokenHttpResponse.h:7
Definition EnvironmentQueryResponse.h:12
Definition CachedAsyncRetry.h:7
Definition MakeCodeFileIOReadResult.h:10
Definition MinecraftServiceKeyInfo.h:5
Definition MinecraftServiceKeysMetadata.h:5
Definition CommandExecutor.h:12
Definition PackCommandResult.h:7
Definition PackSourceLoadResult.h:5
Definition PackModifications.h:7
Definition TaskGroup.h:68
Definition TaskGroup.h:71
Definition TaskStartInfo.h:5
Definition context.h:5