Search Results for

    Show / Hide Table of Contents

    Class Synchronization

    Utilities for inter-thread synchronization. All Locker method acquire their object immediately, and should only be used with langword_csharp_using to automatically release them.

    Inheritance
    System.Object
    Synchronization
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: IPA.Utilities.Async
    Assembly: IPA.Loader.dll
    Syntax
    public static class Synchronization
    Examples

    The canonical usage of all of the member functions is as follows, substituting Lock(Mutex) with whichever member you want to use, according to your lock type.

    using var _locker = Synchronization.Lock(mutex);

    Methods

    | Improve this Doc View Source

    Lock(Mutex)

    Creates a locker for a mutex.

    Declaration
    public static Synchronization.MutexLocker Lock(Mutex mut)
    Parameters
    Type Name Description
    System.Threading.Mutex mut

    the mutex to acquire

    Returns
    Type Description
    Synchronization.MutexLocker

    the locker to use with langword_csharp_using

    | Improve this Doc View Source

    Lock(Semaphore)

    Creates a locker for a semaphore.

    Declaration
    public static Synchronization.SemaphoreLocker Lock(Semaphore sem)
    Parameters
    Type Name Description
    System.Threading.Semaphore sem

    the semaphore to acquire

    Returns
    Type Description
    Synchronization.SemaphoreLocker

    the locker to use with langword_csharp_using

    | Improve this Doc View Source

    Lock(SemaphoreSlim)

    Creates a locker for a slim semaphore.

    Declaration
    public static Synchronization.SemaphoreSlimLocker Lock(SemaphoreSlim sem)
    Parameters
    Type Name Description
    System.Threading.SemaphoreSlim sem

    the slim semaphore to acquire

    Returns
    Type Description
    Synchronization.SemaphoreSlimLocker

    the locker to use with langword_csharp_using

    | Improve this Doc View Source

    LockAsync(SemaphoreSlim)

    Creates a locker for a slim semaphore asynchronously.

    Declaration
    public static async Task<Synchronization.SemaphoreSlimAsyncLocker> LockAsync(SemaphoreSlim sem)
    Parameters
    Type Name Description
    System.Threading.SemaphoreSlim sem

    the slim semaphore to acquire async

    Returns
    Type Description
    System.Threading.Tasks.Task<Synchronization.SemaphoreSlimAsyncLocker>

    the locker to use with langword_csharp_using

    | Improve this Doc View Source

    LockRead(ReaderWriterLockSlim)

    Creates a locker for a read lock on a System.Threading.ReaderWriterLockSlim.

    Declaration
    public static Synchronization.ReaderWriterLockSlimReadLocker LockRead(ReaderWriterLockSlim rwl)
    Parameters
    Type Name Description
    System.Threading.ReaderWriterLockSlim rwl

    the lock to acquire in read mode

    Returns
    Type Description
    Synchronization.ReaderWriterLockSlimReadLocker

    the locker to use with langword_csharp_using

    | Improve this Doc View Source

    LockReadUpgradable(ReaderWriterLockSlim)

    Creates a locker for an upgradable read lock on a System.Threading.ReaderWriterLockSlim.

    Declaration
    public static Synchronization.ReaderWriterLockSlimUpgradableReadLocker LockReadUpgradable(ReaderWriterLockSlim rwl)
    Parameters
    Type Name Description
    System.Threading.ReaderWriterLockSlim rwl

    the lock to acquire in upgradable read mode

    Returns
    Type Description
    Synchronization.ReaderWriterLockSlimUpgradableReadLocker

    the locker to use with langword_csharp_using

    | Improve this Doc View Source

    LockWrite(ReaderWriterLockSlim)

    Creates a locker for a write lock System.Threading.ReaderWriterLockSlim.

    Declaration
    public static Synchronization.ReaderWriterLockSlimWriteLocker LockWrite(ReaderWriterLockSlim rwl)
    Parameters
    Type Name Description
    System.Threading.ReaderWriterLockSlim rwl

    the lock to acquire in write mode

    Returns
    Type Description
    Synchronization.ReaderWriterLockSlimWriteLocker

    the locker to use with langword_csharp_using

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX