Kochol Game Engine  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kge::core::KgeMutex Class Reference

Mutex are used to help threads share their objects. More...

#include <KgeMutex.h>

Inheritance diagram for kge::core::KgeMutex:
kge::KgeUnknown

Public Member Functions

 KgeMutex ()
 Constructor.
 ~KgeMutex ()
 Destructor.
void On () const
 Turn mutex on.
bool TryOn () const
void Off () const
- Public Member Functions inherited from kge::KgeUnknown
 KgeUnknown ()
 Constructor.
virtual ~KgeUnknown ()
 Destructor.
virtual void AddRef ()
 Add a reference to the object.
virtual void DecRef ()
 Decrease a reference from the object. if its reference count get 0 then the object will destroy.
u32 GetRefCount ()
 Return resource reference count.
const char * GetDebugText ()
 returns the instance debug text.

Protected Attributes

SDL_mutex * m_pSdlMutex

Friends

class KgeCond

Additional Inherited Members

- Protected Member Functions inherited from kge::KgeUnknown
void SetDebugText (char *text)

Detailed Description

Mutex are used to help threads share their objects.

Definition at line 13 of file KgeMutex.h.

Constructor & Destructor Documentation

kge::core::KgeMutex::KgeMutex ( )

Constructor.

kge::core::KgeMutex::~KgeMutex ( )

Destructor.

Member Function Documentation

void kge::core::KgeMutex::Off ( ) const

Turn mutex off

Warning
It is an error to unlock a mutex that has not been locked by the current thread, and doing so results in undefined behavior.

Referenced by kge::core::TSQueue< Task * >::empty(), kge::core::TSQueue< Task * >::push(), kge::core::TSQueue< Task * >::try_pop(), and kge::core::TSQueue< Task * >::wait_and_pop().

bool kge::core::KgeMutex::TryOn ( ) const

Try to turn on the mutex

Returns
true on succeed, false on time out

Friends And Related Function Documentation

friend class KgeCond
friend

Definition at line 15 of file KgeMutex.h.

Member Data Documentation

SDL_mutex* kge::core::KgeMutex::m_pSdlMutex
protected

Definition at line 44 of file KgeMutex.h.


The documentation for this class was generated from the following file: