| 174 | |
| 175 | |
| 176 | void CriticalSection::lock(bool errorCheck) |
| 177 | { |
| 178 | #ifdef _WIN32 |
| 179 | |
| 180 | if(WaitForSingleObject(mutex, INFINITE) == WAIT_FAILED && errorCheck) |
| 181 | throw(W32Error("CriticalSection::lock()")); |
| 182 | |
| 183 | #else |
| 184 | |
| 185 | int ret; |
| 186 | if((ret = pthread_mutex_lock(&mutex)) != 0 && errorCheck) |
| 187 | throw(Error("CriticalSection::lock()", strerror(ret))); |
| 188 | |
| 189 | #endif |
| 190 | } |
| 191 | |
| 192 | |
| 193 | void CriticalSection::unlock(bool errorCheck) |