use app->quit on main thread instead of oc_should_quit(), to ensure that runloop_thread always exits its event loop before main thread
This commit is contained in:
parent
1907663cdc
commit
19ce7447aa
|
@ -565,7 +565,7 @@ i32 orca_runloop(void* user)
|
||||||
{
|
{
|
||||||
case OC_EVENT_WINDOW_CLOSE:
|
case OC_EVENT_WINDOW_CLOSE:
|
||||||
{
|
{
|
||||||
oc_request_quit();
|
oc_request_quit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -841,6 +841,8 @@ i32 orca_runloop(void* user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app->quit = true;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -889,7 +891,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
oc_thread* runloopThread = oc_thread_create(orca_runloop, 0);
|
oc_thread* runloopThread = oc_thread_create(orca_runloop, 0);
|
||||||
|
|
||||||
while(!oc_should_quit())
|
while(!app->quit)
|
||||||
{
|
{
|
||||||
oc_pump_events(-1);
|
oc_pump_events(-1);
|
||||||
//TODO: what to do with mem scratch here?
|
//TODO: what to do with mem scratch here?
|
||||||
|
@ -899,7 +901,6 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
oc_canvas_destroy(app->debugOverlay.canvas);
|
oc_canvas_destroy(app->debugOverlay.canvas);
|
||||||
oc_surface_destroy(app->debugOverlay.surface);
|
oc_surface_destroy(app->debugOverlay.surface);
|
||||||
|
|
||||||
oc_window_destroy(app->window);
|
oc_window_destroy(app->window);
|
||||||
|
|
||||||
oc_terminate();
|
oc_terminate();
|
||||||
|
|
|
@ -111,6 +111,7 @@ typedef struct oc_debug_overlay
|
||||||
|
|
||||||
typedef struct oc_runtime
|
typedef struct oc_runtime
|
||||||
{
|
{
|
||||||
|
bool quit;
|
||||||
oc_window window;
|
oc_window window;
|
||||||
|
|
||||||
oc_file_table fileTable;
|
oc_file_table fileTable;
|
||||||
|
|
Loading…
Reference in New Issue