Tramway SDK
async.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_FRAMEWORK_ASYNC_H
5#define TRAM_SDK_FRAMEWORK_ASYNC_H
6
7#include <cmath>
8
9namespace tram {
10
11class EntityComponent;
12class Resource;
13
14}
15
16namespace tram::Async {
17
18void RequestResource(EntityComponent* requester, Resource* resource);
19void CancelRequest(EntityComponent* requester, Resource* resource);
20void LoadDependency(Resource* res);
21void Init(size_t threads = 1);
22void Yeet();
25void FinishResources();
26size_t GetWaitingResources();
27
28}
29
30#endif // TRAM_SDK_FRAMEWORK_ASYNC_H
Definition: async.cpp:16
void CancelRequest(EntityComponent *requester, Resource *resource)
Cancels a resource load request.
Definition: async.cpp:53
void LoadResourcesFromDisk()
Processes the first resource queue.
Definition: async.cpp:101
void LoadResourcesFromMemory()
Processes the second resource queue.
Definition: async.cpp:117
void Yeet()
Stops the async resource loader thread.
Definition: async.cpp:162
void RequestResource(EntityComponent *requester, Resource *resource)
Adds a resource to the loading queue.
Definition: async.cpp:39
void Init(size_t threads)
Starts the async resource loader thread.
Definition: async.cpp:143
void LoadDependency(Resource *res)
Loads a resource from disk, skipping the queue.
Definition: async.cpp:63
void FinishResources()
Notifies EntityComponents about finished resources.
Definition: async.cpp:131
size_t GetWaitingResources()
Returns number of resources in queues.
Definition: async.cpp:175
Resource
Definition: stats.h:13
Definition: api.h:9