Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
XThreadSync.h
1// xThreadSync.h: interface for the thread synchronization classes
2//
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(XTHREADSYNC_INCLUDE_H)
6#define XTHREADSYNC_INCLUDE_H
7
8#ifdef _MSC_VER
9#pragma once
10#endif // _MSC_VER
11
12#include "xosoperation.h"
13
14BEGIN_MOOTOOLS_NAMESPACE
15
16/////////////////////////////////////////////////////////////////////////////
17// CXCriticalSection
18
19class DLL_TOOLSFUNCTION CXCriticalSection
20{
21// Constructor
22public:
24 virtual ~CXCriticalSection();
25
26 bool Unlock();
27 bool Lock();
28 bool IsLocked() const;
29
30private:
31 xCriticalSection section;
32 int count;
33};
34
35/////////////////////////////////////////////////////////////////////////////
36// CXSingleLock
37class DLL_TOOLSFUNCTION CXSingleLock
38{
39// Constructors
40public:
41 // Useful for handling lock in method that require to lock the thread safe guard while a return data is used.
42 // CXSingleLock lock;
43 // void *data = AClass::GetData(&lock); // Data can be used safely until lock is valid.
44 explicit CXSingleLock();
46 virtual ~CXSingleLock();
47
48 // Operations
49 void Attach(CXCriticalSection *pCriticalSection); // Attach and lock provided critical section. (Unlock any critical section already attached).
50 bool Lock();
51 bool Unlock();
52
53protected:
54 CXCriticalSection *m_pObject;
55 bool m_bAcquired;
56};
57
58END_MOOTOOLS_NAMESPACE
59
60#endif // !defined(XTHREADSYNC_INCLUDE_H)
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Definition XThreadSync.h:20
Definition XThreadSync.h:38