VoiceRoomThreadManager.java 1.04 KB
package com.chudiangameplay.android.manager;

import com.chudiangameplay.android.MyApplication;
import com.chudiangameplay.android.model.CurrentUserSettings;
import com.chudiangameplay.android.model.WorkerThread;

/**
 * Created by Administrator on 2018/8/20.
 */

public class VoiceRoomThreadManager {

    private static WorkerThread mWorkerThread;

    public static synchronized void initWorkerThread() {
        if (mWorkerThread == null) {
            mWorkerThread = new WorkerThread(MyApplication.context);
            mWorkerThread.start();

            mWorkerThread.waitForReady();
        }
    }

    public static synchronized WorkerThread getWorkerThread() {
        return mWorkerThread;
    }

    public static synchronized void deInitWorkerThread() {
        mWorkerThread.exit();
        try {
            mWorkerThread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        mWorkerThread = null;
    }

    public static final CurrentUserSettings mAudioSettings = new CurrentUserSettings();

}