aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/SchedulerThread.cs
blob: bab7b03e61683b470e25b876f98c94469576fc1c (plain) (blame)
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
using System;
using System.Threading;

namespace Ryujinx.HLE.HOS.Kernel
{
    class SchedulerThread : IDisposable
    {
        public KThread Thread { get; private set; }

        public SchedulerThread Next { get; set; }

        public bool IsActive { get; set; }

        public AutoResetEvent   WaitSync     { get; private set; }
        public ManualResetEvent WaitActivity { get; private set; }
        public AutoResetEvent   WaitSched    { get; private set; }

        public SchedulerThread(KThread Thread)
        {
            this.Thread = Thread;

            IsActive = true;

            WaitSync  = new AutoResetEvent(false);

            WaitActivity = new ManualResetEvent(true);

            WaitSched = new AutoResetEvent(false);
        }

        public void Dispose()
        {
            Dispose(true);
        }

        protected virtual void Dispose(bool Disposing)
        {
            if (Disposing)
            {
                WaitSync.Dispose();

                WaitActivity.Dispose();

                WaitSched.Dispose();
            }
        }
    }
}