Hello everyone,
I have code setup in the following way:
static ThreadSafeFunction uglyGlobalCallback = nullptr;
// ...much later in the lifetime of the module
void SetCallback(const CallbackInfo &info) {
auto callback = info[0].As<Function>();
uglyGlobalCallback = ThreadSafeFunction(info.Env(), callback, "UglyGlobal", 0, 1);
}
// this is a not exposed C++ function
void TriggerCallback() {
if (/* uglyGlobalCallback is not set */) {
// bail out
return;
}
// uglyGlobalCallback.Call etc...
}
I was able to just check for the global callback to be != nullptr on MacOs but then I encountered a problem porting the code to Windows. On Windows the check is marked as error as no suitable operator matches the pair.
I understand the global itself is not very clean code but this is legacy stuff I would prefer not to change too much so, is there a safe way to check if the ThreadSafeFunction is actually initialised before calling it ?
Thank you :)
Hello everyone,
I have code setup in the following way:
I was able to just check for the global callback to be
!= nullptron MacOs but then I encountered a problem porting the code to Windows. On Windows the check is marked as error as no suitable operator matches the pair.I understand the global itself is not very clean code but this is legacy stuff I would prefer not to change too much so, is there a safe way to check if the ThreadSafeFunction is actually initialised before calling it ?
Thank you :)