QMutex 的lock()暂停不住线程

问题遇到的现象和发生背景

我想使用QMutex来实现线程的暂停和继续,但是调用lock()线程却还在继续跑。

用代码块功能插入代码,请勿粘贴截图

void videoPlayThread::run()
{
    Mat frame;
    while(this->stop==0)
    {

        if(cap.read(frame))
        {
            this->curFrame++;
            qDebug()<<this->curFrame;
            if(save==1)
            {
                emit sendSave(frame);
                this->save=0;
            }
            emit sendMat(frame);
            msleep(20/speed);
        }

    }
    qDebug()<<"over";
    cap.release();
}


void videoPlayThread::Pause()
{
    this->mutex->lock();
    this->pause=1;
    qDebug()<<"pause";
}

void videoPlayThread::Resume()
{
    this->mutex->unlock();
    this->pause=0;
    qDebug()<<"play";
}

void videoPlayThread::setPause()
{
    if(this->pause==0)
    {
        this->Pause();

    }
    else
    {
        this->Resume();
    }

}
运行结果及报错内容

调用Pause()和Resume()的时候都有打印出pause 和play但是线程却没有停下来

要去lock已经被lock住的mutex线程才会停,而且如果lock真的让线程停了,你后面的pause=1和qDebug在线程继续前根本不会执行