cesium-native icon indicating copy to clipboard operation
cesium-native copied to clipboard

Add AsyncSystem::waitInMainThread

Open kring opened this issue 2 years ago • 0 comments

Adds a new method, waitInMainThread, to AsyncSystem.

Calling asyncSystem.waitInMainThread(std::move(future)) is similar to calling future.wait(). Both wait for the future to resolve or reject, and then either return the value or throw an exception. waitInMainThread also continues to dispatch main thread tasks while waiting, however. This means that it is safe to call from the main thread even if the future has thenInMainThread continuations. future.wait(), on the other hand, is very likely to deadlock in this situation.

kring avatar Mar 04 '24 08:03 kring