Code example for Lock

Methods: lock, unlock

0
    public void releaseSurface() { 
        lock.unlock();
    } 
 
    public void surfaceCreated(SurfaceHolder holder) {
        lock.lock();
        surface = holder.getSurface();
        lock.unlock();
    } 
 
    public void surfaceChanged(SurfaceHolder holder, int format,
                                int width, int height) {
    } 
 
    public void surfaceDestroyed(SurfaceHolder holder) {
        Log.d("Showtime", "VideoRenderer surface destroyed");
        lock.lock();
        surface = null;
        lock.unlock();
   }