diff options
Diffstat (limited to 'include/corecg/SkThread.h')
-rw-r--r-- | include/corecg/SkThread.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/corecg/SkThread.h b/include/corecg/SkThread.h new file mode 100644 index 0000000000..ac548c476c --- /dev/null +++ b/include/corecg/SkThread.h @@ -0,0 +1,40 @@ +#ifndef SkThread_DEFINED +#define SkThread_DEFINED + +#include "SkTypes.h" +#include "SkThread_platform.h" + +/****** SkThread_platform needs to define the following... + +int32_t sk_atomic_inc(int32_t*); +int32_t sk_atomic_dec(int32_t*); + +class SkMutex { +public: + SkMutex(); + ~SkMutex(); + + void acquire(); + void release(); +}; + +****************/ + +class SkAutoMutexAcquire { +public: + explicit SkAutoMutexAcquire(SkMutex& mutex) : fMutex(mutex) + { + mutex.acquire(); + } + ~SkAutoMutexAcquire() + { + fMutex.release(); + } +private: + SkMutex& fMutex; + + // illegal + SkAutoMutexAcquire& operator=(SkAutoMutexAcquire&); +}; + +#endif |