상속: java.lang.Object, Channel, InterruptibleChannel
예제 #1
0
        /// <summary>
        /// Marks the beginning of an I/O operation that might block indefinitely.
        ///
        /// <para> This method should be invoked in tandem with the <seealso cref="#end end"/>
        /// method, using a <tt>try</tt>&nbsp;...&nbsp;<tt>finally</tt> block as
        /// shown <a href="#be">above</a>, in order to implement interruption for
        /// this selector.
        ///
        /// </para>
        /// <para> Invoking this method arranges for the selector's {@link
        /// Selector#wakeup wakeup} method to be invoked if a thread's {@link
        /// Thread#interrupt interrupt} method is invoked while the thread is
        /// blocked in an I/O operation upon the selector.  </para>
        /// </summary>
        protected internal void Begin()
        {
            if (Interruptor == null)
            {
                Interruptor = new InterruptibleAnonymousInnerClassHelper(this);
            }
            AbstractInterruptibleChannel.BlockedOn(Interruptor);
            Thread me = Thread.CurrentThread;

            if (me.Interrupted)
            {
                Interruptor.interrupt(me);
            }
        }
예제 #2
0
 /// <summary>
 /// Marks the end of an I/O operation that might block indefinitely.
 ///
 /// <para> This method should be invoked in tandem with the <seealso cref="#begin begin"/>
 /// method, using a <tt>try</tt>&nbsp;...&nbsp;<tt>finally</tt> block as
 /// shown <a href="#be">above</a>, in order to implement interruption for
 /// this selector.  </para>
 /// </summary>
 protected internal void End()
 {
     AbstractInterruptibleChannel.BlockedOn(null);
 }
 public InterruptibleAnonymousInnerClassHelper(AbstractInterruptibleChannel outerInstance)
 {
     this.OuterInstance = outerInstance;
 }