2020-02-09 02:35:16 +00:00
|
|
|
using System;
|
2015-11-18 19:36:37 +00:00
|
|
|
using System.Threading;
|
2018-03-10 08:05:56 +00:00
|
|
|
using Jackett.Common.Services.Interfaces;
|
2015-11-18 19:36:37 +00:00
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
namespace Jackett.Common.Services
|
2015-11-18 19:36:37 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
public class TrayLockService : ITrayLockService
|
|
|
|
{
|
2018-06-27 12:02:51 +00:00
|
|
|
private readonly string EVENT_HANDLE_NAME = @"Global\JACKETT.TRAY";
|
2015-11-18 19:36:37 +00:00
|
|
|
|
|
|
|
private EventWaitHandle GetEventHandle()
|
|
|
|
{
|
2020-02-09 02:35:16 +00:00
|
|
|
return new EventWaitHandle(false, EventResetMode.ManualReset, EVENT_HANDLE_NAME);
|
2015-11-18 19:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void WaitForSignal()
|
|
|
|
{
|
|
|
|
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
|
|
|
|
{
|
|
|
|
GetEventHandle().Reset();
|
|
|
|
GetEventHandle().WaitOne();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Signal()
|
|
|
|
{
|
|
|
|
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
|
|
|
|
{
|
|
|
|
GetEventHandle().Set();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|