mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-09-01 03:30:06 +00:00
update components
This commit is contained in:
parent
7669e821f1
commit
71919dcc05
3 changed files with 15 additions and 57 deletions
|
|
@ -343,46 +343,4 @@ namespace Emby.Server.Implementations.Data
|
|||
return new WriteLockToken(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SemaphpreSlimExtensions
|
||||
{
|
||||
private sealed class WriteLockToken : IDisposable
|
||||
{
|
||||
private SemaphoreSlim _sync;
|
||||
public WriteLockToken(SemaphoreSlim sync)
|
||||
{
|
||||
_sync = sync;
|
||||
var task = sync.WaitAsync();
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
if (_sync != null)
|
||||
{
|
||||
_sync.Release();
|
||||
_sync = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DummyToken : IDisposable
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static IDisposable Read(this SemaphoreSlim obj)
|
||||
{
|
||||
return Write(obj);
|
||||
}
|
||||
public static IDisposable Write(this SemaphoreSlim obj)
|
||||
{
|
||||
//if (BaseSqliteRepository.ThreadSafeMode > 0)
|
||||
//{
|
||||
// return new DummyToken();
|
||||
//}
|
||||
return new WriteLockToken(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue