summaryrefslogtreecommitdiffhomepage
path: root/compat/shm.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-12-25 09:53:52 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-12-25 09:53:52 +0100
commitbab093ebbe392927a92ef201fe60344d5c1191dd (patch)
tree7f062abab2f17f614a3a81e2836a15e90cef3496 /compat/shm.hpp
parent323dd162f5326b998e1c92ab4cfec8a63574023f (diff)
compat/shm, proto/wine: remove duplication
The X-Plane plugin is next and should build on win32 then.
Diffstat (limited to 'compat/shm.hpp')
-rw-r--r--compat/shm.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/compat/shm.hpp b/compat/shm.hpp
new file mode 100644
index 00000000..a8e0965b
--- /dev/null
+++ b/compat/shm.hpp
@@ -0,0 +1,34 @@
+/* Copyright (c) 2013 Stanislaw Halik <sthalik@misaki.pl>
+
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+#ifndef SHMXX_HEADER_GUARD
+#define SHMXX_HEADER_GUARD
+
+#include "export.hpp"
+#include "shm.h"
+
+#ifndef SHMXX_TYPE_NAME
+# define SHMXX_TYPE_NAME mem
+#endif
+
+class OTR_COMPAT_EXPORT SHMXX_TYPE_NAME final
+{
+ shm_mem_impl impl;
+
+public:
+ SHMXX_TYPE_NAME(const char* shm_name, const char* mutex_name, int map_size);
+ ~SHMXX_TYPE_NAME();
+
+ bool success() noexcept;
+ void* ptr() noexcept;
+ void lock() noexcept;
+ void unlock() noexcept;
+
+ SHMXX_TYPE_NAME& operator=(const SHMXX_TYPE_NAME&) = delete;
+ SHMXX_TYPE_NAME& operator=(SHMXX_TYPE_NAME&&) noexcept;
+};
+
+#endif // SHMXX_HEADER_GUARD