summaryrefslogtreecommitdiff
path: root/map65/stdout_channel.h
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-06-22 12:03:55 +0200
committerChristoph Berg <myon@debian.org>2026-06-22 12:03:55 +0200
commitde18fc13175a5bf0e2b48a042d2fc06e87c88d24 (patch)
treef517074cd603d30eb7ba7e2122d38051e4c1439c /map65/stdout_channel.h
parentb76e8361909e47f0937d4a64a5a4cb5939f51eb7 (diff)
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
Update upstream source from tag 'upstream/3.0.2+dfsg'
Update to upstream version '3.0.2+dfsg' with Debian dir 90381fe7be9f5ea84d9b16c9cccf200a3fbe138b
Diffstat (limited to 'map65/stdout_channel.h')
-rw-r--r--map65/stdout_channel.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/map65/stdout_channel.h b/map65/stdout_channel.h
new file mode 100644
index 00000000..21795986
--- /dev/null
+++ b/map65/stdout_channel.h
@@ -0,0 +1,43 @@
+// stdout_channel.h
+#pragma once
+#include "stdout_shared_memory.h"
+#include <string>
+#include <stdexcept>
+
+// Cross-platform event API implemented in win_event_shim.c or posix_event_shim.c
+extern "C" {
+ void* win_create_event();
+ int win_set_event(void*);
+ int win_reset_event(void*);
+ int win_wait_for_single_object(void*);
+ void win_close_event(void*);
+}
+
+struct StdoutChannel
+{
+ StdoutSharedMemory shared;
+ void* eventHandle;
+
+ StdoutChannel(const std::wstring &mappingName,
+ const std::wstring & /*eventName*/,
+ std::size_t bufferBytes)
+ : shared(mappingName, sizeof(StdoutSharedHeader) + bufferBytes),
+ eventHandle(nullptr)
+ {
+ // Cross-platform event creation
+ eventHandle = win_create_event();
+ if (!eventHandle)
+ throw std::runtime_error("win_create_event failed for stdout channel");
+ }
+
+ ~StdoutChannel()
+ {
+ if (eventHandle) {
+ win_close_event(eventHandle);
+ eventHandle = nullptr;
+ }
+ }
+
+ StdoutChannel(const StdoutChannel&) = delete;
+ StdoutChannel& operator=(const StdoutChannel&) = delete;
+};