void onReadingThreadStarted ( ) { boolean bothStarted = false ; synchronized ( mThreadsLock ) { mReadingThreadStarted = true ; if ( mWritingThreadStarted ) { // Both the reading thread and the writing thread have started. bothStarted = true ; } } // Call onConnected() method of listeners if not called yet. callOnConnectedIfNotYet ( ) ; // If both the reading thread and the writing thread have started. if ( bothStarted ) { onThreadsStarted ( ) ; } }
Called by the reading thread as its first step .