IT. Expert System.

Android Reference

ConditionVariable


android.os

Class ConditionVariable



  • public class ConditionVariable
    extends Object
    Class that implements the condition variable locking paradigm.

    This differs from the built-in java.lang.Object wait() and notify() in that this class contains the condition to wait on itself. That means open(), close() and block() are sticky. If open() is called before block(), block() will not block, and instead return immediately.

    This class uses itself as the object to wait on, so if you wait() or notify() on a ConditionVariable, the results are undefined.

    • Constructor Summary

      Constructors
      Constructor and Description
      ConditionVariable()
      Create the ConditionVariable in the default closed state.
      ConditionVariable(boolean state)
      Create the ConditionVariable with the given state.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      void block()
      Block the current thread until the condition is opened.
      boolean block(long timeout)
      Block the current thread until the condition is opened or until timeout milliseconds have passed.
      void close()
      Reset the condition to the closed state.
      void open()
      Open the condition, and release all threads that are blocked.
    • Constructor Detail

      • ConditionVariable

        public ConditionVariable()
        Create the ConditionVariable in the default closed state.
      • ConditionVariable

        public ConditionVariable(boolean state)
        Create the ConditionVariable with the given state.

        Pass true for opened and false for closed.

    • Method Detail

      • open

        public void open()
        Open the condition, and release all threads that are blocked.

        Any threads that later approach block() will not block unless close() is called.

      • close

        public void close()
        Reset the condition to the closed state.

        Any threads that call block() will block until someone calls open.

      • block

        public void block()
        Block the current thread until the condition is opened.

        If the condition is already opened, return immediately.

      • block

        public boolean block(long timeout)
        Block the current thread until the condition is opened or until timeout milliseconds have passed.

        If the condition is already opened, return immediately.

        Parameters:
        timeout - the minimum time to wait in milliseconds.
        Returns:
        true if the condition was opened, false if the call returns because of the timeout.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 2631 / . Delta: 0.03402 с