Interface IBareLock
Provides abstraction of synchronization. It also allows its protected object to be accessed only after a synchronization begins.
Asynchronous operations are not supported. The protected object is non-null.
Namespace: InSync
Assembly: InSync.dll
Syntax
public interface IBareLock
Methods
BarelyLock()
Synchronously acquires the lock and returns the protected non-null object.
Declaration
object BarelyLock()
Returns
Type | Description |
---|---|
System.Object | The protected non-null object. |
Exceptions
Type | Condition |
---|---|
LockException |
BarelyTryLock(Int32, out Nullable<Object>)
Tries to acquire the lock. It returns true
and the protected non-null object if the lock is acquired.
Declaration
bool BarelyTryLock(int millisecondsTimeout, out object? value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | millisecondsTimeout | The number of milliseconds to wait, |
System.Nullable<System.Object> | value | The protected non-null object if the lock is acquired, otherwise, |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
LockException |
BarelyTryLock(out Nullable<Object>)
Tries to acquire the lock. It returns true
and the protected non-null object if the lock is acquired.
Declaration
bool BarelyTryLock(out object? value)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | value | The protected non-null object if the lock is acquired, otherwise, |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
LockException |
BarelyTryLock(TimeSpan, out Nullable<Object>)
Tries to acquire the lock. It returns true
and the protected non-null object if the lock is acquired.
Declaration
bool BarelyTryLock(TimeSpan timeout, out object? value)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | A |
System.Nullable<System.Object> | value | The protected non-null object if the lock is acquired, otherwise, |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
LockException |
BarelyUnlock()
Releases the lock.
Declaration
void BarelyUnlock()
Exceptions
Type | Condition |
---|---|
UnlockException |