#ifndef FFMPEG_THREAD_H
#define FFMPEG_THREAD_H
#include <pthread.h>
class Thread
{
public:
Thread();
~Thread();
void start();
void startAsync();
int wait();
void waitOnNotify();
void notify();
virtual void stop();
protected:
bool mRunning;
virtual void handleRun(void* ptr);
private:
pthread_t mThread;
pthread_mutex_t mLock;
pthread_cond_t mCondition;
static void* startThread(void* ptr);
};
#endif //FFMPEG_DECODER_H
void* Thread::startThread(void* ptr)
{
Thread* thread = (Thread *) ptr;
thread->mRunning = true;
thread->handleRun(ptr);
thread->mRunning = false;
}
void Thread::handleRun(void* ptr)
{
}
在这段代码中,thread.cpp。在线程对象内部,它开始运行并具有 HandleRun 函数,但它是空的。HandleRun 空函数的目的是什么?它什么也不做。