2021-10-02 10:28:49 +00:00
|
|
|
/***
|
2022-04-05 01:19:37 +00:00
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
2021-10-02 10:28:49 +00:00
|
|
|
|
|
|
|
File: LSMutex.Linux.hpp
|
2022-04-05 01:19:37 +00:00
|
|
|
Date: 2022-4-4
|
2021-10-02 10:28:49 +00:00
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
2022-04-05 01:19:37 +00:00
|
|
|
#include "LSHandle.hpp"
|
2021-10-02 10:28:49 +00:00
|
|
|
|
2022-06-11 23:52:46 +00:00
|
|
|
namespace Aurora::IO::Loop
|
2021-10-02 10:28:49 +00:00
|
|
|
{
|
2022-05-04 15:34:02 +00:00
|
|
|
struct LSMutex : ILSMutex, public LSHandle
|
2022-04-05 01:19:37 +00:00
|
|
|
{
|
|
|
|
LSMutex();
|
2022-04-15 10:01:43 +00:00
|
|
|
LSMutex(int handle);
|
2022-04-07 01:20:46 +00:00
|
|
|
~LSMutex();
|
2022-04-05 01:19:37 +00:00
|
|
|
|
|
|
|
bool Unlock() override;
|
|
|
|
|
|
|
|
virtual bool OnTrigger(AuUInt handle) override;
|
|
|
|
|
|
|
|
bool IsSignaled() override;
|
2022-04-12 21:26:15 +00:00
|
|
|
bool WaitOn(AuUInt32 timeout) override;
|
2022-04-05 01:19:37 +00:00
|
|
|
virtual ELoopSource GetType() override;
|
|
|
|
|
2022-08-07 04:18:34 +00:00
|
|
|
bool bNoAutoRel {};
|
2022-04-05 01:19:37 +00:00
|
|
|
private:
|
|
|
|
void Init();
|
2022-04-05 02:36:39 +00:00
|
|
|
bool IsSignaledNonblocking();
|
2022-08-07 04:18:34 +00:00
|
|
|
bool bOwns {};
|
2022-04-05 01:19:37 +00:00
|
|
|
};
|
2021-10-02 10:28:49 +00:00
|
|
|
}
|