Oracle® Fusion Middleware .NET API Reference for Oracle Coherence
12c (12.2.1.4.0)
E90869-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: 12.2.1.4014 (12.2.1.4014)

Syntax

C#
public bool BarEntry(
	long millis
)

Parameters

millis
Type: System..::..Int64
Maximum number of milliseconds to wait; pass -1 for forever or 0 for no wait.

Return Value

true 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