private void checkRunning() {
        synchronized (LOCK) {
            if (this.handler == null) {
                if (openCount <= 0) {
                    throw new IllegalStateException("CameraThread is not open");
                }
                this.thread = new HandlerThread("CameraThread");
                this.thread.start();
                this.handler = new Handler(thread.getLooper());
            }
        }
    }
Call from main thread or camera thread.

Enqueues a task on the camera thread.

@param runnable the task to enqueue
@param delayMillis the delay in milliseconds before executing the runnable
zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraThread.java