diff options
Diffstat (limited to 'compat/shm.h')
| -rw-r--r-- | compat/shm.h | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/compat/shm.h b/compat/shm.h index ffd1e1dc..5036b335 100644 --- a/compat/shm.h +++ b/compat/shm.h @@ -19,30 +19,26 @@ #include <sys/types.h> #endif -#ifdef __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wattributes" -#endif - #include "export.hpp" +#include "macros.h" -class OTR_COMPAT_EXPORT PortableLockedShm { -public: - PortableLockedShm(const char *shmName, const char *mutexName, int mapSize); - ~PortableLockedShm(); - void lock(); - void unlock(); - bool success(); - inline void* ptr() { return mem; } -private: +class OTR_COMPAT_EXPORT shm_wrapper final +{ void* mem; #if defined(_WIN32) - HANDLE hMutex, hMapFile; + HANDLE mutex, mapped_file; #else - int fd, size; + int fd; + unsigned size; #endif -}; -#ifdef __GNUC__ -# pragma GCC diagnostic pop -#endif +public: + shm_wrapper(const char *shm_name, const char *mutex_name, int map_size); + ~shm_wrapper(); + bool lock(); + bool unlock(); + bool success(); + inline void* ptr() { return mem; } + + OTR_DISABLE_MOVE_COPY(shm_wrapper); +}; |
