Update CriticalSection.cpp
Fix comments, add spacing, add newline
This commit is contained in:
parent
b1caa76be6
commit
e630f1248e
|
@ -29,12 +29,13 @@ CriticalSection::~CriticalSection(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Enters a critical section of code.
|
Enters a critical section of code.
|
||||||
* Prevents other threads from accessing the section between the enter and leave sections simultaneously.
|
Prevents other threads from accessing the section between the enter and leave sections simultaneously.
|
||||||
* @note It is good practice to try and keep the critical section code as little as possible, so that
|
Note: It is good practice to try and keep the critical section code as little as possible, so that
|
||||||
* other threads are not locked waiting for it.
|
other threads are not locked waiting for it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CriticalSection::enter(void)
|
void CriticalSection::enter(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -44,13 +45,14 @@ void CriticalSection::enter(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Leaves the critical section.
|
Leaves the critical section.
|
||||||
* Allows threads access to the critical code section again.
|
Allows threads access to the critical code section again.
|
||||||
* @warning Note that an exception occurring with a critical section may not result in the expected leave being
|
Warning: Note that an exception occurring with a critical section may not result in the expected leave being
|
||||||
* called. To ensure that your critical section is exception safe, ensure that you wrap the critical
|
called. To ensure that your critical section is exception safe, ensure that you wrap the critical
|
||||||
* section in a try catch, and the catch calls the leave method.
|
section in a try catch, and the catch calls the leave method.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CriticalSection::leave(void)
|
void CriticalSection::leave(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -58,4 +60,4 @@ void CriticalSection::leave(void)
|
||||||
#else
|
#else
|
||||||
pthread_mutex_unlock((pthread_mutex_t *)m_cs);
|
pthread_mutex_unlock((pthread_mutex_t *)m_cs);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue