Show / Hide Table of Contents

Class ThreadGateSlim

ThreadGateSlim exposes a ReaderWriterLockSlim through the Gate interface.

Inheritance
object
ThreadGateSlim
Implements
Gate
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Tangosol.Util
Assembly: Coherence.dll
Syntax
public class ThreadGateSlim : Gate

Properties

IsClosedByCurrentThread

Determines if the current thread has Closed the Gate but not yet Opened the Gate.

Declaration
public bool IsClosedByCurrentThread { get; }
Property Value
Type Description
bool

IsEnteredByCurrentThread

Determines if the current thread has Entered, but not yet Exited the Gate.

Declaration
public bool IsEnteredByCurrentThread { get; }
Property Value
Type Description
bool

Methods

Close(long)

Tries to acquire the exclusive lock, the attempt is willing to wait up the specified millis or -1 to wait infinite.

Declaration
public bool Close(long millis)
Parameters
Type Name Description
long millis

If the value is positive the caller will block for this long until either the lock has been acquired. If 0 an immediate attempt is made. If -1 wait an infinite time for the lock to be acquired.

Returns
Type Description
bool

true if the lock has been acquired.

Enter(long)

Tries to acquire the non-exclusive lock, the attempt is willing to wait up the specified millis or -1 to wait infinite.

Declaration
public bool Enter(long millis)
Parameters
Type Name Description
long millis

If the value is positive the caller will block for this long until either the lock has been acquired. If 0 an immediate attempt is made. If -1 wait an infinite time for the lock to be acquired.

Returns
Type Description
bool

true if the lock has been acquired.

Exit()

Releases the non-exclusive lock. If the non-exclusive lock has no more matching Enter(millis) from any thread the exclusive lock is released so that threads wanting to Close the Gate can proceed.

Declaration
public void Exit()

Open()

Releases the exclusive lock. If the exclusive lock has no more matching Close(millis) the exclusive lock is released. Any Threads waiting to Enter(millis) or Close(millis) will continue executing.

If the thread currently is also holding the non-exclusive lock, the thread will immediately Enter the lock. The thread will have to match all calls to Enter(millis) with the corresponding count of Exit().

Declaration
public void Open()

Implements

Gate
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.