Code example for SynchronousQueue

Methods: pollputtake

0
    } 
 
    private void error(String msg) {
        Log.e(LOGTAG, msg);
        try { 
            mDataQueue.put("ERROR\n" + msg + "\n");
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } 
    } 
 
    private void eglError(EGL10 egl, String msg) {
        error(msg + " (EGL error " + Integer.toHexString(egl.eglGetError()) + ")");
    } 
 
    public String getData() {
        String data = mDataQueue.poll();
        if (data != null)
            return data;
 
        error("We need the GfxInfo data, but it is not yet available. " + 
              "We have to wait for it, so expect abnormally long startup times. " + 
              "Please report a Mozilla bug."); 
        try { 
            data = mDataQueue.take();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } 
        Log.i(LOGTAG, "GfxInfo data is finally available.");
        return data;