FileDocCategorySizeDatePackage
CameraThread.javaAPI DocAndroid 1.5 API2450Wed May 06 22:42:42 BST 2009com.android.camera

CameraThread

public class CameraThread extends Object

Fields Summary
private Thread
mThread
private int
mTid
private boolean
mTidSet
private boolean
mFinished
Constructors Summary
public CameraThread(Runnable r)

        Runnable wrapper = new Runnable() {
            public void run() {
                setTid(Process.myTid());
                try {
                    r.run();
                } finally {
                    setFinished();
                }
            }
        };

        mThread = new Thread(wrapper);
    
Methods Summary
public longgetId()

        return mThread.getId();
    
public voidjoin()

        try {
            mThread.join();
        } catch (InterruptedException ex) {
            // ok?
        }
    
public java.lang.ThreadrealThread()

        return mThread;
    
private synchronized voidsetFinished()

        mFinished = true;
    
public synchronized voidsetName(java.lang.String name)

        mThread.setName(name);
    
public synchronized voidsetPriority(int androidOsPriority)

        while (!mTidSet) {
            try {
                CameraThread.this.wait();
            } catch (InterruptedException ex) {
                // ok, try again
            }
        }
        if (!mFinished)
            Process.setThreadPriority(mTid, androidOsPriority);
    
private synchronized voidsetTid(int tid)

        mTid = tid;
        mTidSet = true;
        CameraThread.this.notifyAll();
    
public synchronized voidstart()

        mThread.start();
    
public synchronized voidtoBackground()

        setPriority(Process.THREAD_PRIORITY_BACKGROUND);
    
public synchronized voidtoForeground()

        setPriority(Process.THREAD_PRIORITY_FOREGROUND);