Update CriticalSection.cpp

Fix comments, add spacing, add newline
This commit is contained in:
Derek "Turtle" Roe 2021-03-16 18:13:00 -05:00
parent b1caa76be6
commit e630f1248e
1 changed files with 14 additions and 12 deletions

View File

@ -29,12 +29,13 @@ CriticalSection::~CriticalSection(void)
#endif
}
/**
* Enters a critical section of code.
* 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
* other threads are not locked waiting for it.
/*
Enters a critical section of code.
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
other threads are not locked waiting for it.
*/
void CriticalSection::enter(void)
{
#ifdef _WIN32
@ -44,13 +45,14 @@ void CriticalSection::enter(void)
#endif
}
/**
* Leaves the critical section.
* 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
* 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.
/*
Leaves the critical section.
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
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.
*/
void CriticalSection::leave(void)
{
#ifdef _WIN32