C# Class SIL.Utils.GlobalMutex

This is a cross-platform, global, named mutex that can be used to synchronize access to data across processes. It supports reentrant locking. This is needed because Mono does not support system-wide, named mutexes. Mono does implement the Mutex class, but even when using the constructors with names, it only works within a single process.
Inheritance: SIL.Utils.FwDisposableBase
Afficher le fichier Open project: sillsdev/FieldWorks Class Usage Examples

Méthodes publiques

Méthode Description
GlobalMutex ( string name ) : System

Initializes a new instance of the GlobalMutex class.

Initialize ( ) : bool

Initializes this mutex.

InitializeAndLock ( ) : IDisposable

Initializes and locks this mutex. This is an atomic operation on Windows, but not Linux.

InitializeAndLock ( bool &createdNew ) : IDisposable

Initializes and locks this mutex. On Windows, this is an atomic operation, so the "createdNew" variable is guaranteed to return a correct value. On Linux, this is not an atomic operation, so "createdNew" is guaranteed to be correct only if it returns true.

Lock ( ) : IDisposable

Locks this mutex.

Unlink ( ) : bool

Unlinks or removes the mutex from the system. This only has an effect on Linux. Windows will automatically unlink the mutex. This can be called while the mutex is locked.

Méthodes protégées

Méthode Description
DisposeManagedResources ( ) : void

Disposes managed resources.

Method Details

DisposeManagedResources() protected méthode

Disposes managed resources.
protected DisposeManagedResources ( ) : void
Résultat void

GlobalMutex() public méthode

Initializes a new instance of the GlobalMutex class.
public GlobalMutex ( string name ) : System
name string
Résultat System

Initialize() public méthode

Initializes this mutex.
public Initialize ( ) : bool
Résultat bool

InitializeAndLock() public méthode

Initializes and locks this mutex. This is an atomic operation on Windows, but not Linux.
public InitializeAndLock ( ) : IDisposable
Résultat IDisposable

InitializeAndLock() public méthode

Initializes and locks this mutex. On Windows, this is an atomic operation, so the "createdNew" variable is guaranteed to return a correct value. On Linux, this is not an atomic operation, so "createdNew" is guaranteed to be correct only if it returns true.
public InitializeAndLock ( bool &createdNew ) : IDisposable
createdNew bool
Résultat IDisposable

Lock() public méthode

Locks this mutex.
public Lock ( ) : IDisposable
Résultat IDisposable

Unlink() public méthode

Unlinks or removes the mutex from the system. This only has an effect on Linux. Windows will automatically unlink the mutex. This can be called while the mutex is locked.
public Unlink ( ) : bool
Résultat bool