• 3507阅读
  • 0回复

[原创]QThread::start: Failed to create thread。 [复制链接]

上一主题 下一主题
离线shixingya
 

只看楼主 倒序阅读 楼主  发表于: 2018-04-25
Critical: File:() Line:(0) Fun:() (2018-04-25 16:37:53 周三) QThread::start: Failed to create thread (设备不识别此命令。)
Fatal: File:() Line:(0) Fun:() (2018-04-25 16:38:19 周三) createDIB: CreateDIBSection failed.

程序报错如上, 求大神提供解bug的思路, 程序中开了30个子线程, 相关代码如下
void TaskQueueManager::clearThreadList(GtList<QThread*>&threadList)
{
    int count =threadList.count();
    for(int i=0; i<count; i++)
    {
        QThread *thread =threadList;
        thread->quit();
        thread->wait();
    }
    threadList.clear();
}
void TaskQueueManager::initThreadList(int threadCount, GtList<QThread*>& threadList)
{
    threadList.clear();
    for(int i=0; i<threadCount; i++)
    {
        QThread *thread =new QThread(this);
        thread->start(QThread::TimeCriticalPriority);
        threadList.push_back(thread);
    }
}


auto circleTaskList =[&](GtList<TaskRunner*>& _waitTasks,  GtList<QThread*> &threadList , QMap<QThread*,TaskRunner*> &runningTasks )
    {
        while(_waitTasks.count()>0 && runningTasks.count() <threadList.count())
        {

            TaskRunner* runner = _waitTasks.takeFirst();
            if(runner)
            {
                for(int i=0; i<threadList.count(); i++)
                {
                    QThread* thread =threadList;
                    if(runningTasks.contains(thread))
                        continue;
                    else
                    {
                        connect(runner, SIGNAL(taskFinish(void*)), this,SLOT(onUpdateTaskList()));

                        runner->moveToThread(thread);
                        runningTasks.insert(thread,runner);
                        QTimer::singleShot(0,runner, &TaskRunner::on_DoRequest);
                        break;
                    }
                }

            }
        }
    } ;


本人2008年9月至2012年6月在三亚学院学习计算机科学与技术专业四年,2012年6月毕业后至今一直在北京市从事软件开发相关工作。本人的技术栈是C++、熟悉Qt、CEF框架。参与或负责过多款Windows、Linux环境下桌面软件的研发。
参加工作十年来,使用Qt参与开发过一个军工仿真想定建模工具,仿真陆、海、空潜等各兵种的作战平台(包括地面车辆、水面舰艇、固定翼/旋转翼飞机、潜艇等)的运动方式和工作流程,实现陆、海、空、潜立体化协同作战仿真。在国美调研过电商OA办公工具的开发设计、在广联达参与了BIM软件的协作开发、在书生电子独立负责过OFD版式阅读器客户端的开发、在跟谁学使用Qt WebEngine、QGraphics等主导了练习批改工具的开发,在蓝湖基于WebAssembly对标Figma参与开发了一款原型设计工具mastergo,在小米集团技术委员会承担了平台应用研发工作,目前在凌云光从事视觉相关应用平台开发。十多年的软件开发工作,让我在软件工程、程序设计、系统架构方面积累了丰富且宝贵的经验。
有同行的朋友,可以加我微信,一起进步
我叫史星亚 微信: EagleAndy  
加好友时请备注  来自qtcn
我有个Qt交友群,拉您入群
非工作时间 可以电联 18610042411
*********************************************************
另低价出售
→各种软件小程序定制!
→SAP教程,涵盖BI/SD/FICO/HANA等各种模块视频教程,购买教程,拾取金领顾问教程!
→各种考证考研题库,保证考证考研成功上岸!
→抖音快手微博朋友圈各种点赞支持,最快一分钟上万赞!
→挂机打卡,远程叫醒,等各种服务欢迎私信EagleAndy开启!
转发此内容,私信EagleAndy,有定制盲盒寄送!
快速回复
限100 字节
 
上一个 下一个