/// <summary> /// 指定したキーで待機します。 /// </summary> /// <param name="key">待機するキー</param> public static async Task WaitAsync(string key) { await LockSemaphore.WaitAsync(); try { if (!Semaphores.ContainsKey(key)) { Semaphores.Add(key, new SemaphoreSlim(1, 1)); } } finally { LockSemaphore.Release(); } await Semaphores[key].WaitAsync(); }
private void InternalUnlock(Task t) => LockSemaphore.Release();