作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
#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 空函数的目的是什么?它什么都不做。
最佳答案
您没有显示足够的代码来给出明确的答案。猜测,Thread
可能是 handleRun
是 virtual
的基类。
从 Thread
派生的类可能会自动创建一个专用线程,使用 handleRun
作为其入口点。
关于c++ - thread.cpp 的 handleRun 的空函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16863236/
不久前我收到了这个异常,我从堆栈跟踪中找不到任何有用的东西,Crashlytics 报告它发生在 Android 8 和 9 上 这是堆栈跟踪: Fatal Exception: java.lang.
#ifndef FFMPEG_THREAD_H #define FFMPEG_THREAD_H #include class Thread { public: Thread();
我是一名优秀的程序员,十分优秀!