ThreadGate Class |
Note: This API is now obsolete.
Namespace: Tangosol.Util
[ObsoleteAttribute("Use GateFactory.NewGate to obtain a Gate.")] public class ThreadGate : Gate
The ThreadGate type exposes the following members.
| Name | Description | |
|---|---|---|
| ThreadGate |
Allocates unnamed data slots on threads to store local thread
counter values and returns new instance of ThreadGate.
|
| Name | Description | |
|---|---|---|
| ActiveCount |
The number of unmatched completed Enter calls.
| |
| CloseCount |
The number of unmatched completed Close/BarEntry calls.
| |
| ClosingThread |
The thread that is closing the gates.
| |
| IsActiveThread |
Determine if the current thread has entered and not exited the
thread gate.
| |
| IsClosedByCurrentThread |
Determines if the current thread have Closed the gate but not yet
Opened the Gate.
| |
| IsClosingThread |
Determine if the current thread has closed and not opened the
the thread gate.
| |
| IsEnteredByCurrentThread |
Determine if the current thread has entered and not exited the
thread gate.
| |
| Status |
The current thread gate status.
| |
| Version |
The total number of times the gate has been fully opened.
|
| Name | Description | |
|---|---|---|
| BarEntry |
Bar entry of the thread gate by other threads, but do not wait
for the gate to close.
| |
| Close |
Close the thread gate.
| |
| DecrementThreadLocalCount |
Decrement the long value of the LocalDataStoreSlot for the
current thread by one.
| |
| Destroy |
Destroy the thread gate.
| |
| DoWait |
Wait up to the specified number of milliseconds for notification.
| |
| Enter |
Enter the thread gate.
| |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| Exit |
Exit the gate.
| |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetThreadLocalCount |
Obtain the long value stored in the LocalDataStoreSlot.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IncrementThreadLocalCount |
Increment the long value from the LocalDataStoreSlot for
the current thread by one.
| |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Open |
After entry into the ThreadGate is restricted by a call to
BarEntry() or Close(), it can be re-opened by calling this
method.
| |
| SetThreadLocalCount |
Set the long value to be stored in the LocalDataStoreSlot.
| |
| ToString |
Provide a human-readable representation of this ThreadGate.
(Overrides ObjectToString.) | |
| UpdateStatus |
Update the current thread gate status, without changing the
active count.
|
Each call to Enter requires a corresponding call to Exit. For example, the following would ensure proper clean-up using a ThreadGate:
gate.Enter();
try
{
...
}
finally
{
gate.Exit();
}
Similarly, each call to Close should be matched with a call to Open, unless the gate is being destroyed:
gate.Close();
try
{
...
}
finally
{
gate.Open();
}
or:
gate.Close();
gate.Destroy();
The Enter/Exit calls can be nested; the same thread can invoke Enter multiple times as long as Exit is invoked a corresponding number of times. The Close/Open calls work in the same manner. Lastly, the thread that closes the gate may continue to Enter/Exit the gate even when it is closed since that thread has exclusive control of the gate.