Cross-platform Mutex. More...
#include <thread.h>
Public Member Functions | |
virtual | ~ThreadMutex () |
Virtual Destructor to avoid compiler warnings. | |
virtual void | BeginCritical (bool allow_recursive=false)=0 |
Begin the critical section. | |
virtual void | EndCritical (bool allow_recursive=false)=0 |
End of the critical section. | |
virtual void | WaitForSignal ()=0 |
Wait for a signal to be send. | |
virtual void | SendSignal ()=0 |
Send a signal and wake the 'thread' that was waiting for it. | |
Static Public Member Functions | |
static ThreadMutex * | New () |
Create a new mutex. |
Cross-platform Mutex.
Definition at line 55 of file thread.h.
virtual void ThreadMutex::BeginCritical | ( | bool | allow_recursive = false |
) | [pure virtual] |
Begin the critical section.
allow_recursive | Whether recursive locking is intentional. If false, NOT_REACHED() will be called when the mutex is already locked by the current thread. |
Implemented in ThreadMutex_None, ThreadMutex_OS2, ThreadMutex_pthread, and ThreadMutex_Win32.
Referenced by _GenerateWorld(), GRFFileScanner::AddFile(), VideoDriver_Win32::AfterBlitterChange(), VideoDriver_SDL::AfterBlitterChange(), VideoDriver_Win32::ChangeResolution(), VideoDriver_SDL::ChangeResolution(), PacketWriter::Destroy(), DoScanNewGRFFiles(), DrawDirtyBlocks(), VideoDriver_Win32::EditBoxLostFocus(), PacketWriter::Finish(), GenerateWorld(), VideoDriver_Win32::MainLoop(), VideoDriver_SDL::MainLoop(), NetworkBackgroundUDPLoop(), NetworkGameListAddItemDelayed(), NetworkGameListHandleDelayedInsert(), NetworkUDPAdvertiseThread(), NetworkUDPClose(), NetworkUDPInitialize(), NetworkUDPQueryServer(), NetworkUDPRemoveAdvertiseThread(), openttd_main(), PacketWriter::PopPacket(), ScanNewGRFFiles(), ThreadMutexLocker::ThreadMutexLocker(), VideoDriver_Win32::ToggleFullscreen(), VideoDriver_SDL::ToggleFullscreen(), WaitTillGeneratedWorld(), PacketWriter::Write(), and PacketWriter::~PacketWriter().
virtual void ThreadMutex::EndCritical | ( | bool | allow_recursive = false |
) | [pure virtual] |
End of the critical section.
allow_recursive | Whether recursive unlocking is intentional. If false, NOT_REACHED() will be called when the mutex was locked more than once by the current thread. |
Implemented in ThreadMutex_None, ThreadMutex_OS2, ThreadMutex_pthread, and ThreadMutex_Win32.
Referenced by _GenerateWorld(), GRFFileScanner::AddFile(), VideoDriver_Win32::AfterBlitterChange(), VideoDriver_SDL::AfterBlitterChange(), VideoDriver_Win32::ChangeResolution(), VideoDriver_SDL::ChangeResolution(), PacketWriter::Destroy(), DoScanNewGRFFiles(), DrawDirtyBlocks(), VideoDriver_Win32::EditBoxLostFocus(), PacketWriter::Finish(), GenerateWorld(), VideoDriver_Win32::MainLoop(), VideoDriver_SDL::MainLoop(), NetworkBackgroundUDPLoop(), NetworkGameListAddItemDelayed(), NetworkGameListHandleDelayedInsert(), NetworkUDPAdvertiseThread(), NetworkUDPClose(), NetworkUDPInitialize(), NetworkUDPQueryServer(), NetworkUDPRemoveAdvertiseThread(), PacketWriter::PopPacket(), ScanNewGRFFiles(), VideoDriver_Win32::ToggleFullscreen(), VideoDriver_SDL::ToggleFullscreen(), WaitTillGeneratedWorld(), PacketWriter::Write(), PacketWriter::~PacketWriter(), and ThreadMutexLocker::~ThreadMutexLocker().
virtual void ThreadMutex::WaitForSignal | ( | ) | [pure virtual] |
Wait for a signal to be send.
Implemented in ThreadMutex_None, ThreadMutex_OS2, ThreadMutex_pthread, and ThreadMutex_Win32.
Referenced by VideoDriver_SDL::MainLoop(), and PacketWriter::~PacketWriter().