AuroraRuntime/Source/IO/IPC/IPCMutexFutex.Linux.hpp
J Reece Wilson 64cb7404ba [+] Near 1:1 Linux IPC Pipe compared to the NT equivalent (~= CreateNamedPipeA(nMaxInstances=1, dwOpenMode=PIPE_ACCESS_DUPLEX, dwPipeMode=PIPE_TYPE_BYTE))
[+] Ability to bypass blocking limitation of certain io_submit reads, if the blocking subsystem is a pollable stream (ie: a pipe).
[*] Fixed major Linux bug where LoopQueue items weren't being submitted, if no dequeues were in the same tick
[*] Fix various Linux pipe related bugs
[*] Fix futex bug where the callback was nulled on server-release
2022-08-09 07:48:29 +01:00

48 lines
1.1 KiB
C++
Executable File

#pragma once
#include "IPCHandle.hpp"
#include "IPCPrimitives.Linux.hpp"
namespace Aurora::IO::IPC
{
struct IMutexClosedHook
{
virtual bool OnClosed() = 0;
};
struct IPCPipeImpl;
struct IPCMutexProxy : IPCMutex, Loop::ILoopSourceEx, AuEnableSharedFromThis<IPCMutexProxy>, IMutexClosedHook
{
IPCMutexProxy(AuUInt32 index);
IPCMutexProxy(int handle, AuSPtr<IPCSharedMemory> mem, AuUInt32 index);
~IPCMutexProxy();
PROXY_INTERNAL_INTERFACE(mutex_)
bool OnClosed() override;
bool Unlock() override;
bool IsSignaled() override;
bool WaitOn(AuUInt32 timeout) override;
Loop::ELoopSource GetType() override;
AuString ExportToString() override;
AuUInt32 *GetFutex();
IMutexClosedHook *pMutexClosedHook {};
private:
bool bOwned {};
IPCToken token_;
AuSPtr<IPCSharedMemory> mem_;
AuUInt32 index_;
Loop::LSMutex mutex_;
AuSPtr<void> leakSelf_;
friend IPCPipeImpl;
};
AuSPtr<IPCMutexProxy> ImportMutexEx(const IPCToken &handle, const IPCToken &mem, AuUInt32 index);
}