1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #ifndef MUTEX_H
- #define MUTEX_H
- #include "unicode/utypes.h"
- #include "unicode/uobject.h"
- #include "umutex.h"
- U_NAMESPACE_BEGIN
- class U_COMMON_API Mutex : public UMemory {
- public:
- Mutex(UMutex *mutex = nullptr) : fMutex(mutex) {
- umtx_lock(fMutex);
- }
- ~Mutex() {
- umtx_unlock(fMutex);
- }
- Mutex(const Mutex &other) = delete;
- Mutex &operator=(const Mutex &other) = delete;
- void *operator new(size_t s) = delete;
- private:
- UMutex *fMutex;
- };
- U_NAMESPACE_END
- #endif
|