IsRunningTasksOnBTSThread
The IsRunningTasksOnBTSThread method is a utility function that checks whether the current code is executing on the BTS (Background Thread Script) thread.
This is crucial for thread safety. Before calling any N-API functions or accessing resources that are only safe to use on the BTS thread, you should use this check to prevent crashes and race conditions.
Method Signature
Return Value
true: If the current thread is the BTS thread.false: If the current thread is not the BTS thread (e.g., it is the UI thread or another worker thread).
Usage
Use this method as a guard before performing BTS-thread-specific operations, especially in functions that could be called from multiple threads.
Example
See Also
PostTaskToRuntime(): The method to use when you are not on the BTS thread and need to execute code there.
Compatibility
LCD tables only load in the browser