API usage instruction › arcalet API › Synchronization Issues
Synchronization Issues by arcalet API
All arcalet API object methods are designed to be non-blocking. The call status is given by Event and Callbackobjects. Most Windows platforms and game engine restrictions can only be executed in the main thread controlapplication GUI. The caller must build objects in the main thread or use Callback objects. The arcalet API will bein the main thread to trigger Event or Callback objects.
Please note: triggering Event or Callback objects in the original thread is not absolutely necessary, because the thread can not be interrupted by the application system. Therefore, for the arcalet API to trigger Event or Callback objects from the original thread, the main thread must be controlled by the message queue. In general,every application in Windows, including the window, is controlled by the message queue from the main window.But if the developer uses other applications similar to the console application to develop game play, then the virtual STA (Pseudo Single Thread Apartment) threading model has to be used to complete the original thread trigger Event and Callback.
The virtual STA model is executed by the main thread and is timed to constantly call ArcaletGame.EventDispatcher(). Most of the game engines are frame-based systems -- developers cancall this method in every frame.
Was this page helpful?