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/network/services/signaling/ISignalingServiceConfigProvider.h"
14#include "mc/platform/Copyable.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
54public:
55 // member variables
56 // NOLINTBEGIN
57 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::Scheduler>> mScheduler;
58 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::WorkerPool>> mWorkers;
59 ::ll::TypedStorage<8, 32, ::std::string> mName;
60 ::ll::TypedStorage<1, 1, bool> mCheckOwnerThread;
61 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mLock;
62 ::ll::TypedStorage<4, 4, ::std::atomic<::TaskGroupState>> mState;
63 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mTasks;
64 ::ll::TypedStorage<8, 8, uint64> mTaskCount;
65 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mEnumCurr;
66 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::BackgroundTaskBase>> mEnumNext;
67 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mResumeTaskHandle;
68 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mResumeTaskMutex;
69 // NOLINTEND
70
71public:
72 // prevent constructor by default
73 TaskGroup();
74
75public:
76 // virtual functions
77 // NOLINTBEGIN
78 // vIndex: 1
79 virtual ::Bedrock::Threading::Async<void> queue_DEPRECATED(
80 ::TaskStartInfo const& startInfo,
82 ::std::function<void()>&& callback
83 ) /*override*/;
84
85 // vIndex: 2
86 virtual ::Bedrock::Threading::Async<void> queueSync_DEPRECATED(
87 ::TaskStartInfo const& startInfo,
89 ) /*override*/;
90
91 // vIndex: 0
92 virtual ~TaskGroup() /*override*/;
93
94 // vIndex: 3
95 virtual void taskRegister(::std::shared_ptr<::BackgroundTaskBase> task) /*override*/;
96
97 // vIndex: 4
98 virtual void requeueTask(::std::shared_ptr<::BackgroundTaskBase> task, bool queueImmediate) /*override*/;
99
100 // vIndex: 5
101 virtual ::TaskGroupState getState() const /*override*/;
102
103 // vIndex: 6
104 virtual void processCoroutines() /*override*/;
105
106 // vIndex: 7
107 virtual void taskComplete(::gsl::not_null<::BackgroundTaskBase*> task) /*override*/;
108
109 // vIndex: 8
110 virtual bool _workerPoolIsAsync() const;
111 // NOLINTEND
112
113public:
114 // member functions
115 // NOLINTBEGIN
116 MCAPI TaskGroup(::WorkerPool& workers, ::Scheduler& context, ::std::string name);
117
118 MCAPI void _doWorkUntil(::Bedrock::Threading::SharedAsync<void> task, ::std::promise<void>* workStarted);
119
120 MCAPI void _forAllTasks(
122 ::std::function<void(::std::shared_ptr<::BackgroundTaskBase> const&)> callback
123 );
124
125 MCAPI void _queueInternal(::std::shared_ptr<::BackgroundTaskBase> bgtask);
126
127 MCAPI void flush(::std::function<void()> waitFn);
128
129 MCAPI bool isEmpty() const;
130
131 MCAPI void sync_DEPRECATED_ASK_TOMMO(::std::function<void()> waitFn);
132 // NOLINTEND
133
134public:
135 // static functions
136 // NOLINTBEGIN
137 MCAPI static ::IBackgroundTaskOwner* getCurrentTaskGroup();
138 // NOLINTEND
139
140public:
141 // constructor thunks
142 // NOLINTBEGIN
143 MCAPI void* $ctor(::WorkerPool& workers, ::Scheduler& context, ::std::string name);
144 // NOLINTEND
145
146public:
147 // destructor thunk
148 // NOLINTBEGIN
149 MCAPI void $dtor();
150 // NOLINTEND
151
152public:
153 // virtual function thunks
154 // NOLINTBEGIN
155 MCAPI ::Bedrock::Threading::Async<void> $queue_DEPRECATED(
156 ::TaskStartInfo const& startInfo,
158 ::std::function<void()>&& callback
159 );
160
161 MCAPI ::Bedrock::Threading::Async<void>
162 $queueSync_DEPRECATED(::TaskStartInfo const& startInfo, ::brstd::move_only_function<::TaskResult()>&& task);
163
164 MCAPI void $taskRegister(::std::shared_ptr<::BackgroundTaskBase> task);
165
166 MCAPI void $requeueTask(::std::shared_ptr<::BackgroundTaskBase> task, bool queueImmediate);
167
168 MCFOLD ::TaskGroupState $getState() const;
169
170 MCAPI void $processCoroutines();
171
172 MCAPI void $taskComplete(::gsl::not_null<::BackgroundTaskBase*> task);
173
174 MCAPI bool $_workerPoolIsAsync() const;
175 // NOLINTEND
176
177public:
178 // vftables
179 // NOLINTBEGIN
180 MCNAPI static void** $vftable();
181 // NOLINTEND
182};
Definition BackgroundTaskBase.h:13
Definition SharedAsync.h:8
Definition UniqueLock.h:8
Definition IBackgroundTaskOwner.h:17
Definition Pack.h:27
Definition ResourcePack.h:19
Definition Scheduler.h:13
Definition TaskGroup.h:53
static MCAPI void ** $vftable()
Definition TaskResult.h:5
Definition WorkerPool.h:19
Definition WorldPacksHistoryFile.h:10
Definition move_only_function.h:9
Definition AsyncJoinAllow.h:5
Definition AsyncJoinDeny.h:5
Definition MinecraftServiceKeyInfo.h:5
Definition MinecraftServiceKeysMetadata.h:5
Definition PackSourceLoadResult.h:5
Definition TaskStartInfo.h:5
Definition context.h:5