• Performance
  • API Documentation
  • Source Code
Show / Hide Table of Contents
  • InSync
    • AsyncSynchronized
    • AsyncSynchronized<T>
    • GuardedValue<T>
    • IAsyncSynchronized<T>
    • IBareAsyncLock
    • IBareAsyncLock<T>
    • IBareLock
    • IBareLock<T>
    • ISynchronized<T>
    • LockException
    • MultiSync
    • ReaderSynchronized<TRead>
    • ReaderWriterSynchronized<T>
    • ReaderWriterSynchronized<TWrite, TRead>
    • ReaderWriterSynchronizedFactory
    • Synchronized
    • Synchronized<T>
    • TimingMethod
    • UnlockException
    • UpgradeableReaderSynchronized<TRead>
    • ValueContainer<T>

Interface IBareLock<T>

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.

Inherited Members
IBareLock.BarelyTryLock(Nullable<Object>)
IBareLock.BarelyTryLock(Int32, Nullable<Object>)
IBareLock.BarelyTryLock(TimeSpan, Nullable<Object>)
IBareLock.BarelyUnlock()
Namespace: InSync
Assembly: InSync.dll
Syntax
public interface IBareLock<T> : IBareLock where T : class
Type Parameters
Name Description
T

The type of the protected object.

Methods

BarelyLock()

Synchronously acquires the lock and returns the protected non-null object.

Declaration
T BarelyLock()
Returns
Type Description
T

The protected non-null object.

Exceptions
Type Condition
LockException

BarelyTryLock(out T)

Tries to acquire the lock. It returns true and the protected non-null object if the lock is acquired.

Declaration
bool BarelyTryLock(out T value)
Parameters
Type Name Description
T value

The protected non-null object if the lock is acquired, otherwise, null is returned.

Returns
Type Description
System.Boolean

true if the lock is acquired.

Exceptions
Type Condition
LockException

BarelyTryLock(Int32, out T)

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 T value)
Parameters
Type Name Description
System.Int32 millisecondsTimeout

The number of milliseconds to wait, (-1) to wait indefinitely, or zero to test the state of the wait handle and return immediately.

T value

The protected non-null object if the lock is acquired, otherwise, null is returned.

Returns
Type Description
System.Boolean

true if the lock is acquired.

Exceptions
Type Condition
LockException

BarelyTryLock(TimeSpan, out T)

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 T value)
Parameters
Type Name Description
TimeSpan timeout

A that represents the number of milliseconds to wait, a that represents -1 milliseconds to wait indefinitely, or a that represents 0 milliseconds to test the wait handle and return immediately.

T value

The protected non-null object if the lock is acquired, otherwise, null is returned.

Returns
Type Description
System.Boolean

true if the lock is acquired.

Exceptions
Type Condition
LockException
In This Article
Back to top Generated by DocFX