All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SVMutex Class Reference

#include <svutil.h>

Public Member Functions

 SVMutex ()
 Sets up a new mutex. More...
 
void Lock ()
 Locks on a mutex. More...
 
void Unlock ()
 Unlocks on a mutex. More...
 

Detailed Description

A mutex which encapsulates the main locking and unlocking abilites of mutexes for windows and unix.

Definition at line 87 of file svutil.h.

Constructor & Destructor Documentation

SVMutex::SVMutex ( )

Sets up a new mutex.

Definition at line 161 of file svutil.cpp.

161  {
162 #ifdef _WIN32
163  mutex_ = CreateMutex(0, FALSE, 0);
164 #else
165  pthread_mutex_init(&mutex_, NULL);
166 #endif
167 }
#define FALSE
Definition: capi.h:29
#define NULL
Definition: host.h:144

Member Function Documentation

void SVMutex::Lock ( )

Locks on a mutex.

Definition at line 169 of file svutil.cpp.

169  {
170 #ifdef _WIN32
171  WaitForSingleObject(mutex_, INFINITE);
172 #else
173  pthread_mutex_lock(&mutex_);
174 #endif
175 }
void SVMutex::Unlock ( )

Unlocks on a mutex.

Definition at line 177 of file svutil.cpp.

177  {
178 #ifdef _WIN32
179  ReleaseMutex(mutex_);
180 #else
181  pthread_mutex_unlock(&mutex_);
182 #endif
183 }

The documentation for this class was generated from the following files: