summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-12-22 17:51:10 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-12-23 11:42:23 -0500
commita3937e7eef97cb0badcd65c390b9dd39d4cfd094 (patch)
treeca793f7630e0130211ed480c915968d743e7b506 /editor
parentfa7fc343a0e444da72938fad58d219cf52228976 (diff)
PkeThreads_Enqueue now takes a pointer to a task
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index db97802..bb19b70 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -98,7 +98,8 @@ void PkeEditor_Tick(double delta) {
if (shouldRunCurrentScene) {
shouldRunCurrentScene = false;
subProgramRunning = true;
- PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
+ auto *task = Pke_New<std::packaged_task<void()>>();
+ new (task) std::packaged_task<void()>( [] {
auto pid = fork();
if (pid == 0) {
int status = -1;
@@ -121,7 +122,8 @@ void PkeEditor_Tick(double delta) {
fprintf(stdout, "pke_runtime (parent) exited with a status of %i (0x%08X)\n", status, status);
subProgramRunning = false;
}
- }));
+ });
+ PkeThreads_Enqueue(threadPoolHandle, task);
}
if (shouldSetupEditor) {
PkeEditor_Setup();
@@ -144,7 +146,8 @@ void PkeEditor_Tick(double delta) {
}
if (shouldOpenLoadSceneDialog) {
shouldOpenLoadSceneDialog = false;
- PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
+ auto *task = Pke_New<std::packaged_task<void()>>();
+ new (task) std::packaged_task<void()>( [] {
const char * patterns[1] = {"*.pstf"};
char *selectedScene = tinyfd_openFileDialog(nullptr, "cafebabe.pstf", 1, patterns, "Pke Scene Text File", 0);
if (selectedScene != nullptr) {
@@ -152,19 +155,22 @@ void PkeEditor_Tick(double delta) {
pkeSettings.rt.shouldLoadScene = true;
ActiveCamera = &NullCamera;
}
- }));
+ });
+ PkeThreads_Enqueue(threadPoolHandle, task);
}
if (shouldOpenSaveSceneDialog) {
shouldOpenSaveSceneDialog = false;
- PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
+ auto *task = Pke_New<std::packaged_task<void()>>();
+ new (task) std::packaged_task<void()>( [] {
const char * patterns[1] = {"*.pstf"};
char *selectedScene = tinyfd_saveFileDialog(nullptr, pkeSettings.rt.sceneName, 1, patterns, "Pke Scene Text File");
if (selectedScene != nullptr) {
pkeSettings.rt.sceneName = selectedScene;
pkeSettings.rt.shouldSaveScene = true;
}
- }));
+ });
+ PkeThreads_Enqueue(threadPoolHandle, task);
}
if (pkeSettings.rt.shouldSaveScene && pkeSettings.rt.sceneName) {
pkeSettings.rt.shouldSaveScene = false;