diff options
author | Paul Adenot <[email protected]> | 2016-07-25 11:33:27 +0200 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2016-07-27 10:46:57 +0200 |
commit | 76d768f79a1f645852cf7ebe0a7bc1130b4bb601 (patch) | |
tree | 5723505b451237b2d12777fc502217becba55091 /src/cubeb_utils.h | |
parent | 5f3d3f506c564e11fdc2446380dc340d44de2c6c (diff) | |
download | cubeb-76d768f79a1f645852cf7ebe0a7bc1130b4bb601.tar.gz cubeb-76d768f79a1f645852cf7ebe0a7bc1130b4bb601.zip |
Add files for mutex implementation on Windows and UNIX
Diffstat (limited to 'src/cubeb_utils.h')
-rw-r--r-- | src/cubeb_utils.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cubeb_utils.h b/src/cubeb_utils.h index 8c992ff..ba38b45 100644 --- a/src/cubeb_utils.h +++ b/src/cubeb_utils.h @@ -11,6 +11,11 @@ #include <stdint.h> #include <string.h> #include <assert.h> +#if defined(WIN32) +#include "cubeb_utils_win.h" +#else +#include "cubeb_utils_unix.h" +#endif /** Similar to memcpy, but accounts for the size of an element. */ template<typename T> @@ -189,4 +194,18 @@ private: size_t length_; }; +struct auto_lock { + auto_lock(owned_critical_section * lock) + : lock(lock) + { + lock->enter(); + } + ~auto_lock() + { + lock->leave(); + } +private: + owned_critical_section * lock; +}; + #endif /* CUBEB_UTILS */ |