Exemplo n.º 1
0
        /// <summary>
        /// Causes the current thread to wait until the latch has counted down to
        /// zero, unless the thread is <seealso cref="Thread#interrupt interrupted"/>.
        ///
        /// <para>If the current count is zero then this method returns immediately.
        ///
        /// </para>
        /// <para>If the current count is greater than zero then the current
        /// thread becomes disabled for thread scheduling purposes and lies
        /// dormant until one of two things happen:
        /// <ul>
        /// <li>The count reaches zero due to invocations of the
        /// <seealso cref="#countDown"/> method; or
        /// <li>Some other thread <seealso cref="Thread#interrupt interrupts"/>
        /// the current thread.
        /// </ul>
        ///
        /// </para>
        /// <para>If the current thread:
        /// <ul>
        /// <li>has its interrupted status set on entry to this method; or
        /// <li>is <seealso cref="Thread#interrupt interrupted"/> while waiting,
        /// </ul>
        /// then <seealso cref="InterruptedException"/> is thrown and the current thread's
        /// interrupted status is cleared.
        ///
        /// </para>
        /// </summary>
        /// <exception cref="InterruptedException"> if the current thread is interrupted
        ///         while waiting </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void await() throws InterruptedException
        public virtual void @await()
        {
            Sync.AcquireSharedInterruptibly(1);
        }