Code example for ConditionVariable

Methods: block

0
    /* 
     * Initializes the message looper so that the Camera object can  
     * receive the callback messages. 
     */ 
    private void initializeMessageLooper() { 
        final ConditionVariable startDone = new ConditionVariable();
        Log.v(TAG, "start looper");
        new Thread() {
            @Override 
            public void run() { 
                // Set up a looper to be used by camera. 
                Looper.prepare();
                Log.v(TAG, "start loopRun");
                // Save the looper so that we can terminate this thread  
                // after we are done with it. 
                mLooper = Looper.myLooper();
                mCamera = Camera.open(CAMERA_ID);
                startDone.open();
                Looper.loop();  // Blocks forever until Looper.quit() is called.
                Log.v(TAG, "initializeMessageLooper: quit.");
            } 
        }.start();
 
        if (!startDone.block(WAIT_FOR_COMMAND_TO_COMPLETE)) {
            fail("initializeMessageLooper: start timeout");
        } 
    } 
     
    /*