diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /map65/stdout_channel.h | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'map65/stdout_channel.h')
| -rw-r--r-- | map65/stdout_channel.h | 43 |
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; +}; |
