Esempio n. 1
0
        /// <summary>
        /// Acquires the lock unless the current thread is
        /// <seealso cref="Thread#interrupt interrupted"/>.
        ///
        /// <para>Acquires the lock if it is not held by another thread and returns
        /// immediately, setting the lock hold count to one.
        ///
        /// </para>
        /// <para>If the current thread already holds this lock then the hold count
        /// is incremented by one and the method returns immediately.
        ///
        /// </para>
        /// <para>If the lock is held by another thread then the
        /// current thread becomes disabled for thread scheduling
        /// purposes and lies dormant until one of two things happens:
        ///
        /// <ul>
        ///
        /// <li>The lock is acquired by the current thread; or
        ///
        /// <li>Some other thread <seealso cref="Thread#interrupt interrupts"/> the
        /// current thread.
        ///
        /// </ul>
        ///
        /// </para>
        /// <para>If the lock is acquired by the current thread then the lock hold
        /// count is set to one.
        ///
        /// </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 acquiring
        /// the lock,
        ///
        /// </ul>
        ///
        /// then <seealso cref="InterruptedException"/> is thrown and the current thread's
        /// interrupted status is cleared.
        ///
        /// </para>
        /// <para>In this implementation, as this method is an explicit
        /// interruption point, preference is given to responding to the
        /// interrupt over normal or reentrant acquisition of the lock.
        ///
        /// </para>
        /// </summary>
        /// <exception cref="InterruptedException"> if the current thread is interrupted </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void lockInterruptibly() throws InterruptedException
        public virtual void LockInterruptibly()
        {
            Sync.AcquireInterruptibly(1);
        }
Esempio n. 2
0
 public void LockInterruptibly()
 {
     sync.AcquireInterruptibly(1);
 }