DBG: more documentation updates
This commit is contained in:
parent
58973dd2a1
commit
55d784fc73
|
|
@ -451,10 +451,6 @@ bool mathhandlebrackets(char* expression, bool silent, bool baseonly)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
- handle math
|
||||
*/
|
||||
|
||||
/**
|
||||
\brief Calculate the value of an expression string.
|
||||
\param string The string to calculate the value of. Cannot be null.
|
||||
|
|
|
|||
|
|
@ -1,34 +1,57 @@
|
|||
/**
|
||||
@file threading.cpp
|
||||
|
||||
@brief Implements the threading class.
|
||||
@brief Implements various functions for syncing threads.
|
||||
*/
|
||||
|
||||
#include "threading.h"
|
||||
|
||||
/**
|
||||
\brief The lock values.
|
||||
*/
|
||||
static volatile bool waitarray[WAITID_LAST];
|
||||
|
||||
/**
|
||||
\brief Sets all lock values to 0.
|
||||
*/
|
||||
void waitclear()
|
||||
{
|
||||
memset((void*)waitarray, 0, sizeof(waitarray));
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Waits while a lock is 1.
|
||||
\param id The lock to wait for.
|
||||
*/
|
||||
void wait(WAIT_ID id)
|
||||
{
|
||||
while(waitarray[id]) //1=locked, 0=unlocked
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Sets a lock to 1.
|
||||
\param id The lock to set.
|
||||
*/
|
||||
void lock(WAIT_ID id)
|
||||
{
|
||||
waitarray[id] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Sets a lock to 0.
|
||||
\param id The lock to set.
|
||||
*/
|
||||
void unlock(WAIT_ID id)
|
||||
{
|
||||
waitarray[id] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Returns the lock value.
|
||||
\param id The lock to check.
|
||||
\return true if locked, false otherwise.
|
||||
*/
|
||||
bool waitislocked(WAIT_ID id)
|
||||
{
|
||||
return waitarray[id];
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "_global.h"
|
||||
|
||||
//enums
|
||||
enum WAIT_ID
|
||||
{
|
||||
WAITID_RUN,
|
||||
|
|
@ -18,6 +17,9 @@ void lock(WAIT_ID id);
|
|||
void unlock(WAIT_ID id);
|
||||
bool waitislocked(WAIT_ID id);
|
||||
|
||||
/**
|
||||
\brief Locks that can be used in the CriticalSectionLocker class.
|
||||
*/
|
||||
enum CriticalSectionLock
|
||||
{
|
||||
LockMemoryPages,
|
||||
|
|
@ -35,21 +37,59 @@ enum CriticalSectionLock
|
|||
LockLast
|
||||
};
|
||||
|
||||
/**
|
||||
\brief A critical section locker.
|
||||
*/
|
||||
class CriticalSectionLocker
|
||||
{
|
||||
public:
|
||||
/**
|
||||
\brief Deinitialises the critical sections.
|
||||
*/
|
||||
static void Deinitialize();
|
||||
|
||||
/**
|
||||
\brief This initialized a new instance of CriticalSectionLocker and it enters the critical section.
|
||||
\param lock The critical section to enter.
|
||||
*/
|
||||
CriticalSectionLocker(CriticalSectionLock lock);
|
||||
|
||||
~CriticalSectionLocker();
|
||||
|
||||
/**
|
||||
\brief Unlocks the critical section lock.
|
||||
*/
|
||||
void unlock();
|
||||
|
||||
/**
|
||||
\brief Relocks the critical section lock.
|
||||
*/
|
||||
void relock();
|
||||
|
||||
private:
|
||||
/**
|
||||
\brief Initializes the critical section objects.
|
||||
*/
|
||||
static void Initialize();
|
||||
|
||||
/**
|
||||
\brief Boolean indicating if the initialization was done.
|
||||
*/
|
||||
static bool bInitDone;
|
||||
|
||||
/**
|
||||
\brief The critical section objects used for locking.
|
||||
*/
|
||||
static CRITICAL_SECTION locks[LockLast];
|
||||
|
||||
/**
|
||||
\brief The lock.
|
||||
*/
|
||||
CriticalSectionLock gLock;
|
||||
|
||||
/**
|
||||
\brief true if locked, false otherwise.
|
||||
*/
|
||||
bool Locked;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue