ThreadGateBarEntry Method |
Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
14c (14.1.1.0)
F23534-02
Bar entry of the thread gate by other threads, but do not wait
for the gate to close.
Namespace:
Tangosol.Util
Assembly:
Coherence (in Coherence.dll) Version: 14.1.1.14 (14.1.1.14)
Syntaxpublic bool BarEntry(
long millis
)
Parameters
- millis
- Type: SystemInt64
Maximum number of milliseconds to wait; pass -1 for forever or 0
for no wait.
Return Value
Type:
Booleantrue iff entry into the thread gate was successfully
barred by the calling thread.
Remarks
When all other threads have exited, the status of the thread gate
will be closeable by the thread which barred entry. Each
sucessful invocation of this method must ultimately have a
corresponding invocation of the Open method (assuming the thread
gate is not destroyed) even if the calling thread does not
subsequently close the gate.
gate.BarEntry(-1);
try
{
// processing that does not require the gate to be closed
// ...
}
finally
{
gate.Close(-1);
try
{
// processing that does require the gate to be closed
// ...
}
finally
{
gate.Open(); // matches gate.Close()
}
gate.Open(); // matches gate.BarEntry()
}
See Also