ScummVM API documentation
Mutex handling

Description

Historically, the OSystem API used to have a method that allowed creating threads. Hence, mutex support was needed for thread syncing. To ease portability, we decided to remove the threading API. Instead, we now use timers (see setTimerCallback() and Common::Timer). But since those can be implemented using threads (and in fact, that is how our primary backend, the SDL one, does it on many systems), we still must do mutex syncing in our timer callbacks. In addition, the sound mixer uses a mutex in case the backend runs it from a dedicated thread (as the SDL backend does).

Hence, backends that do not use threads to implement the timers can simply use dummy implementations for these methods.

Functions

virtual Common::MutexInternalOSystem::createMutex ()=0
 

Function Documentation

◆ createMutex()

virtual Common::MutexInternal* OSystem::createMutex ( )
pure virtual

Create a new mutex.

Returns
The newly created mutex, or 0 if an error occurred.

Implemented in OSystem_Wii, OSystem_N64, OSystem_Dreamcast, OSystem_DS, OSystem_iOS7, OSystem_PSP, N3DS::OSystem_3DS, OSystem_libretro, OSystem_SDL, and OSystem_Atari.