Collapse All Expand All

C#

Oracle® Coherence .NET API Reference
ThreadGate..::.BarEntry Method
ThreadGate Class See Also Send Feedback

Oracle® Coherence .NET API Reference Release 3.6
E15727-01
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: 3.6.0.0 (3.6.0.0)

# 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

ThreadGate Class
Tangosol.Util Namespace