2015-11-18 19:36:37 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-10-29 10:19:09 +00:00
|
|
|
|
using Jackett.Services.Interfaces;
|
2015-11-18 19:36:37 +00:00
|
|
|
|
|
|
|
|
|
namespace Jackett.Services
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public class TrayLockService : ITrayLockService
|
|
|
|
|
{
|
|
|
|
|
private readonly string EVENT_HANDLE_NAME = "JACKETT.TRAY";
|
|
|
|
|
|
|
|
|
|
private EventWaitHandle GetEventHandle()
|
|
|
|
|
{
|
|
|
|
|
return new EventWaitHandle(false, EventResetMode.ManualReset, EVENT_HANDLE_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|