Move solution and projects to src
This commit is contained in:
parent
cd124bda58
commit
cee7121058
3466 changed files with 55 additions and 55 deletions
58
src/Ryujinx.Horizon/ServiceTable.cs
Normal file
58
src/Ryujinx.Horizon/ServiceTable.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using Ryujinx.Horizon.LogManager;
|
||||
using Ryujinx.Horizon.Prepo;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Horizon
|
||||
{
|
||||
public class ServiceTable
|
||||
{
|
||||
private int _readyServices;
|
||||
private int _totalServices;
|
||||
|
||||
private readonly ManualResetEvent _servicesReadyEvent = new(false);
|
||||
|
||||
public IEnumerable<ServiceEntry> GetServices(HorizonOptions options)
|
||||
{
|
||||
List<ServiceEntry> entries = new();
|
||||
|
||||
void RegisterService<T>() where T : IService
|
||||
{
|
||||
entries.Add(new ServiceEntry(T.Main, this, options));
|
||||
}
|
||||
|
||||
RegisterService<LmMain>();
|
||||
RegisterService<PrepoMain>();
|
||||
|
||||
_totalServices = entries.Count;
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
internal void SignalServiceReady()
|
||||
{
|
||||
if (Interlocked.Increment(ref _readyServices) == _totalServices)
|
||||
{
|
||||
_servicesReadyEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
public void WaitServicesReady()
|
||||
{
|
||||
_servicesReadyEvent.WaitOne();
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_servicesReadyEvent.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue