OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
CStdCSecEx Class Reference

#include <StdSync.h>

Inheritance diagram for CStdCSecEx:
[legend]
Collaboration diagram for CStdCSecEx:
[legend]

Public Member Functions

 CStdCSecEx ()
 
 CStdCSecEx (CStdCSecExCallback *pCallb)
 
 ~CStdCSecEx ()
 
void Enter ()
 
void Leave ()
 
void EnterShared ()
 
void LeaveShared ()
 

Protected Attributes

long lShareCnt
 
CStdEvent ShareFreeEvent
 
CStdCSecExCallbackpCallbClass
 

Detailed Description

Definition at line 190 of file StdSync.h.

Constructor & Destructor Documentation

CStdCSecEx::CStdCSecEx ( )
inline

Definition at line 193 of file StdSync.h.

194  : lShareCnt(0), ShareFreeEvent(false), pCallbClass(nullptr)
195  { }
long lShareCnt
Definition: StdSync.h:204
CStdCSecExCallback * pCallbClass
Definition: StdSync.h:208
CStdEvent ShareFreeEvent
Definition: StdSync.h:206
CStdCSecEx::CStdCSecEx ( CStdCSecExCallback pCallb)
inline

Definition at line 196 of file StdSync.h.

197  : lShareCnt(0), ShareFreeEvent(false), pCallbClass(pCallb)
198  { }
long lShareCnt
Definition: StdSync.h:204
CStdCSecExCallback * pCallbClass
Definition: StdSync.h:208
CStdEvent ShareFreeEvent
Definition: StdSync.h:206
CStdCSecEx::~CStdCSecEx ( )
inline

Definition at line 199 of file StdSync.h.

200  { }

Member Function Documentation

void CStdCSecEx::Enter ( )
inlinevirtual

Reimplemented from CStdCSec.

Definition at line 213 of file StdSync.h.

References CStdCSec::Enter(), INFINITE, CStdCSec::Leave(), CStdEvent::Reset(), and CStdEvent::WaitFor().

214  {
215  // lock
216  CStdCSec::Enter();
217  // wait for share-free
218  while (lShareCnt)
219  {
220  // reset event
222  // leave section for waiting
223  CStdCSec::Leave();
224  // wait
226  // reenter section
227  CStdCSec::Enter();
228  }
229  }
void Reset()
Definition: StdSync.h:160
bool WaitFor(int)
Definition: StdSync.h:161
virtual void Leave()
Definition: StdSync.h:151
virtual void Enter()
Definition: StdSync.h:150
long lShareCnt
Definition: StdSync.h:204
#define INFINITE
Definition: StdSync.h:58
CStdEvent ShareFreeEvent
Definition: StdSync.h:206

Here is the call graph for this function:

void CStdCSecEx::EnterShared ( )
inline

Definition at line 239 of file StdSync.h.

References CStdCSec::Enter(), and CStdCSec::Leave().

240  {
241  // lock
242  CStdCSec::Enter();
243  // add share
244  lShareCnt++;
245  // unlock
246  CStdCSec::Leave();
247  }
virtual void Leave()
Definition: StdSync.h:151
virtual void Enter()
Definition: StdSync.h:150
long lShareCnt
Definition: StdSync.h:204

Here is the call graph for this function:

void CStdCSecEx::Leave ( )
inlinevirtual

Reimplemented from CStdCSec.

Definition at line 231 of file StdSync.h.

References CStdCSec::Leave(), and CStdEvent::Set().

232  {
233  // set event
235  // unlock
236  CStdCSec::Leave();
237  }
virtual void Leave()
Definition: StdSync.h:151
void Set()
Definition: StdSync.h:158
CStdEvent ShareFreeEvent
Definition: StdSync.h:206

Here is the call graph for this function:

void CStdCSecEx::LeaveShared ( )
inline

Definition at line 249 of file StdSync.h.

References CStdCSec::Enter(), CStdCSec::Leave(), CStdCSecExCallback::OnShareFree(), and CStdEvent::Set().

Referenced by CStdShareLock::Clear().

250  {
251  // lock
252  CStdCSec::Enter();
253  // remove share
254  if (!--lShareCnt)
255  {
256  // do callback
257  if (pCallbClass)
258  pCallbClass->OnShareFree(this);
259  // set event
261  }
262  // unlock
263  CStdCSec::Leave();
264  }
virtual void OnShareFree(class CStdCSecEx *pCSec)=0
virtual void Leave()
Definition: StdSync.h:151
virtual void Enter()
Definition: StdSync.h:150
void Set()
Definition: StdSync.h:158
long lShareCnt
Definition: StdSync.h:204
CStdCSecExCallback * pCallbClass
Definition: StdSync.h:208
CStdEvent ShareFreeEvent
Definition: StdSync.h:206

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

long CStdCSecEx::lShareCnt
protected

Definition at line 204 of file StdSync.h.

CStdCSecExCallback* CStdCSecEx::pCallbClass
protected

Definition at line 208 of file StdSync.h.

CStdEvent CStdCSecEx::ShareFreeEvent
protected

Definition at line 206 of file StdSync.h.


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