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/threading/Async.h"
8#include "mc/deps/core/threading/IBackgroundTaskOwner.h"
9#include "mc/deps/core/threading/SharedAsync.h"
10#include "mc/deps/core/threading/TaskGroupState.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/threading/Mutex.h"
19#include "mc/platform/threading/UniqueLock.h"
20#include "mc/server/commands/edu/make_code_fileio/MakeCodeFileResult.h"
21#include "mc/world/level/FileArchiver.h"
22
23// auto generated forward declare list
24// clang-format off
26class Pack;
27class ResourcePack;
28class Scheduler;
29class TaskResult;
30class WorkerPool;
32struct AsyncJoinAllow;
33struct AsyncJoinDeny;
37struct TaskStartInfo;
38namespace Bedrock::Http { class HeaderCollection; }
39namespace Bedrock::Http { class Request; }
40namespace Bedrock::Http { class Response; }
41namespace Bedrock::Http { struct Url; }
42namespace Bedrock::Services { struct AzureGetTokenHttpResponse; }
43namespace Bedrock::Services { struct EnvironmentQueryResponse; }
44namespace Bedrock::Threading { struct CachedAsyncRetry; }
45namespace Json { class Value; }
46namespace JsonRpc { class JsonRpcError; }
47namespace JsonRpc { class TurnConfigResult; }
48namespace MakeCodeFileIO { struct MakeCodeFileIOReadResult; }
49namespace PackCommand { struct PackCommandResult; }
50namespace RepositoryLoading { struct PackModifications; }
51// clang-format on
52
53class TaskGroup : public ::IBackgroundTaskOwner {
54public:
55 // TaskGroup inner types declare
56 // clang-format off
57 template<typename T0> class Thenable;
58 // clang-format on
59
60 // TaskGroup inner types define
61 template <typename T0>
62 class Thenable {};
63
64public:
65 // member variables
66 // NOLINTBEGIN
67 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::Scheduler>> mScheduler;
68 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::WorkerPool>> mWorkers;
69 ::ll::TypedStorage<8, 32, ::std::string> mName;
70 ::ll::TypedStorage<1, 1, bool> mCheckOwnerThread;
71 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mLock;
72 ::ll::TypedStorage<4, 4, ::std::atomic<::TaskGroupState>> mState;
73 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mTasks;
74 ::ll::TypedStorage<8, 8, uint64> mTaskCount;
75 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mEnumCurr;
76 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mEnumNext;
77 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mResumeTaskHandle;
78 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mResumeTaskMutex;
79 // NOLINTEND
80
81public:
82 // prevent constructor by default
83 TaskGroup();
84
85public:
86 // virtual functions
87 // NOLINTBEGIN
88 virtual ::Bedrock::Threading::Async<void> queue_DEPRECATED(
89 ::TaskStartInfo const& startInfo,
91 ::std::function<void()>&& callback
92 ) /*override*/;
93
94 virtual ::Bedrock::Threading::Async<void> queueSync_DEPRECATED(
95 ::TaskStartInfo const& startInfo,
97 ) /*override*/;
98
99 virtual ~TaskGroup() /*override*/;
100
101 virtual void taskRegister(::std::shared_ptr<::BackgroundTaskBase> task) /*override*/;
102
103 virtual void requeueTask(::std::shared_ptr<::BackgroundTaskBase> task, bool queueImmediate) /*override*/;
104
105 virtual ::TaskGroupState getState() const /*override*/;
106
107 virtual void processCoroutines() /*override*/;
108
109 virtual void taskComplete(::gsl::not_null<::BackgroundTaskBase*> task) /*override*/;
110
111 virtual bool _workerPoolIsAsync() const;
112 // NOLINTEND
113
114public:
115 // member functions
116 // NOLINTBEGIN
117 MCAPI TaskGroup(::WorkerPool& workers, ::Scheduler& context, ::std::string name);
118
119 MCAPI void _doWorkUntil(::Bedrock::Threading::SharedAsync<void> task, ::std::promise<void>* workStarted);
120
121 MCAPI void _forAllTasks(
122 ::Bedrock::Threading::UniqueLock<::Bedrock::Threading::Mutex>& lock,
123 ::std::function<void(::std::shared_ptr<::BackgroundTaskBase> const&)> callback
124 );
125
126 MCAPI void _queueInternal(::std::shared_ptr<::BackgroundTaskBase> bgtask);
127
128 MCAPI_C uint64 count() const;
129
130 MCAPI void flush(::std::function<void()> waitFn);
131
132 MCAPI bool isEmpty() const;
133
134 MCAPI_C void kick(uint count);
135
136 MCAPI_C void resume();
137
138 MCAPI void sync_DEPRECATED_ASK_TOMMO(::std::function<void()> waitFn);
139 // NOLINTEND
140
141public:
142 // static functions
143 // NOLINTBEGIN
144 MCAPI static ::IBackgroundTaskOwner* getCurrentTaskGroup();
145 // NOLINTEND
146
147public:
148 // constructor thunks
149 // NOLINTBEGIN
150 MCAPI void* $ctor(::WorkerPool& workers, ::Scheduler& context, ::std::string name);
151 // NOLINTEND
152
153public:
154 // destructor thunk
155 // NOLINTBEGIN
156 MCAPI void $dtor();
157 // NOLINTEND
158
159public:
160 // virtual function thunks
161 // NOLINTBEGIN
162 MCAPI ::Bedrock::Threading::Async<void> $queue_DEPRECATED(
163 ::TaskStartInfo const& startInfo,
164 ::brstd::move_only_function<::TaskResult()>&& task,
165 ::std::function<void()>&& callback
166 );
167
168 MCAPI ::Bedrock::Threading::Async<void>
169 $queueSync_DEPRECATED(::TaskStartInfo const& startInfo, ::brstd::move_only_function<::TaskResult()>&& task);
170
171 MCAPI void $taskRegister(::std::shared_ptr<::BackgroundTaskBase> task);
172
173 MCAPI void $requeueTask(::std::shared_ptr<::BackgroundTaskBase> task, bool queueImmediate);
174
175 MCFOLD ::TaskGroupState $getState() const;
176
177 MCAPI void $processCoroutines();
178
179 MCAPI void $taskComplete(::gsl::not_null<::BackgroundTaskBase*> task);
180
181 MCAPI bool $_workerPoolIsAsync() const;
182
183
184 // NOLINTEND
185
186public:
187 // vftables
188 // NOLINTBEGIN
189 MCNAPI static void** $vftable();
190 // NOLINTEND
191};
Definition BackgroundTaskBase.h:13
Definition HeaderCollection.h:7
Definition Request.h:16
Definition Response.h:13
Definition IBackgroundTaskOwner.h:17
Definition JsonRpcError.h:12
Definition TurnConfigResult.h:13
Definition Value.h:16
Definition Pack.h:27
Definition ResourcePack.h:21
Definition Scheduler.h:14
Definition TaskGroup.h:62
static MCAPI void ** $vftable()
Definition TaskResult.h:5
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:7
Definition MinecraftServiceKeyInfo.h:5
Definition MinecraftServiceKeysMetadata.h:5
Definition PackCommandResult.h:7
Definition PackSourceLoadResult.h:5
Definition PackModifications.h:7
Definition TaskStartInfo.h:5
Definition context.h:5