blob: cad251311797179c0677b0b95d51ee7016e016ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
using System;
using System.Collections.Generic;
namespace Ryujinx.Horizon.Sdk.OsTypes
{
class Event : IDisposable
{
private EventType _event;
public object EventLock => _event.Lock;
public LinkedList<MultiWaitHolderBase> MultiWaitHolders => _event.MultiWaitHolders;
public Event(EventClearMode clearMode)
{
Os.InitializeEvent(out _event, signaled: false, clearMode);
}
public TriBool IsSignaledThreadUnsafe()
{
return _event.Signaled ? TriBool.True : TriBool.False;
}
public void Wait()
{
Os.WaitEvent(ref _event);
}
public bool TryWait()
{
return Os.TryWaitEvent(ref _event);
}
public bool TimedWait(TimeSpan timeout)
{
return Os.TimedWaitEvent(ref _event, timeout);
}
public void Signal()
{
Os.SignalEvent(ref _event);
}
public void Clear()
{
Os.ClearEvent(ref _event);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Os.FinalizeEvent(ref _event);
}
}
public void Dispose()
{
Dispose(true);
}
}
}
|