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