MCPcopy Create free account
hub / github.com/StereoKit/StereoKit / sk_assert_thread_valid

Function sk_assert_thread_valid

StereoKitC/stereokit.cpp:434–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432///////////////////////////////////////////
433
434void sk_assert_thread_valid() {
435 // sk_init and sk_run/step need to happen on the same thread, but there's a
436 // non-zero chance that some async code can inadvertently put execution
437 // onto another thread without the dev's knowledge. This can trip up async
438 // asset code and cause a blocking loop as the asset waits for the main
439 // thread to step. This function is used to detect and warn of such a
440 // situation.
441
442 if (ft_id_matches(local.init_thread) == false) {
443 const char* err = "SK.Run and pre-Run GPU asset creation currently must be called on the same thread as SK.Initialize! Has async code accidentally bumped you to another thread?";
444 log_err(err);
445 platform_msgbox_err(err, "Fatal Error");
446 abort();
447 }
448}
449
450///////////////////////////////////////////
451

Callers 1

sk_first_stepFunction · 0.85

Calls 3

ft_id_matchesFunction · 0.85
log_errFunction · 0.85
platform_msgbox_errFunction · 0.50

Tested by

no test coverage detected