当前位置: 首页 > news >正文

佛山搭建建网站哪家好卖高权重网站做跳转

佛山搭建建网站哪家好,卖高权重网站做跳转,太平洋电脑网站,虚拟主机便宜功能: qt中用多线程的方式调用python脚本,完成C++和python之间的数据交互。为了满足多任务并发的要求,将调用python的逻辑部分封装到QThread的子类PyApiThread中。 主要实现: 包括PyApiThread的实现以及在主线程中如何使用 PyApiThread的的实现,分.h和.cpp两个文件 #ifnd…功能: qt中用多线程的方式调用python脚本,完成C++和python之间的数据交互。为了满足多任务并发的要求,将调用python的逻辑部分封装到QThread的子类PyApiThread中。 主要实现: 包括PyApiThread的实现以及在主线程中如何使用 PyApiThread的的实现,分.h和.cpp两个文件 #ifndef PYAPITHREAD_H #define PYAPITHREAD_H#include "Python.h" #include QMap #include QQueue #include QThread #include QVariantclass QMutex; class Widget; class QEventLoop; class PyApiThread : public QThread {Q_OBJECT public: explicit PyApiThread(Widget* parent = nullptr);~PyApiThread();bool isRunning()const;void setSleepTime(uint ms); Q_INVOKABLE void stopRuning(); Q_INVOKABLE void stopPyApi(const QString pyfile);void addPyApi(const QString pyfile, const QString function,const QStringList paramters, const QVariant attachInfo=""); signals:void stopThreadWork();void startPyApiTask(const QString api);void finishPyApiTask(const QString api, bool cancel);void pyCommandResult(const QVariant result);protected:void run();private:QVariant getPyCmd();QVariant getPyCmdResult();void addPyApiResult(const QVariant result);bool cancelPyApi();void sleepThread(uint ms); void initPythonEnviroement();QVariant parsePyObj(PyObject* obj);QVariant parsePyList(PyObject* obj);QVariant parsePyTuple(PyObject* obj);QVariant parsePyDictionary(PyObject* obj);QVariant parsePySimpleObj(PyObject* obj);const char* printPyApiError(const QString prefix);QVariant executePyScript(const QString pyfile, const QString function,const QStringList paramters, const QVariant attachInfo);bool needExecuteExterProcess(const QString pyfile, const QStringList paramters, QVariantMap result);int executeExterProcess(const QString pyfile, const QStringList paramters);private:uint mSleepTime = 80;bool mRunning = false;//bool mPlatformInit = true;QQueueQVariant mApiQueue; //后面改成无锁队列 QQueueQString mSystemQueue; //后面改成无锁队列QQueueQVariant mApiQueueResult; //后面改成无锁队列QMutex* mMutex = nullptr; QMutex* mSysMutex = nullptr;QEventLoop* mEventLoop = nullptr;Widget* mParent{nullptr};//QMapQString, QVariant(PyApiThread::*)(const QVariantMap) mFuncs; };#endif // PYAPITHREAD_H#include "pyapithread.h" //#include "pyinterface.h" #include "rlog.h" #include "widget.h"#include QDebug #include QMutex #include QTimer #include QWidget #include QDateTime #include QEventLoop #include QtConcurrent #include QCoreApplicationclass PythonThreadLocker {PyGILState_STATE state; public:PythonThreadLocker() : state(PyGILState_Ensure()){}~PythonThreadLocker() {PyGILState_Release(state);} };PyApiThread::PyApiThread(Widget *parent):mParent(parent) { }PyApiThread::~PyApiThread() {if(mMutex){delete mMutex;mMutex = nullptr;}if(mSysMutex){delete mSysMutex;mSysMutex = nullptr;}if(mEventLoop){mEventLoop-quit();delete mEventLoop;mEventLoop = nullptr;}}void PyApiThread::stopRuning() { mRunning = false;mEventLoop-quit();emit stopThreadWork();qDebug()"stopRuning
http://www.pierceye.com/news/821480/

相关文章:

  • 威海高区建设局网站品牌网站建设多少钱
  • 网站php网站空间新乡河南网站建设
  • 你第一个物流网站建设方案信诚网络公司网站
  • 企业建站什么网站好wordpress管理员后台
  • 南京网站开发价格两个wordpress共用一个数据库
  • 番禺制作网站平台柳城网站制作
  • 网站建设相关视频教程网页设计布局有哪几种方法
  • 能接做网站的活的网站上海建网站方案
  • 免费网站软件app大全飘雪影院手机免费观看免费
  • 怎么做类似淘宝的网站石家庄网络开发公司
  • 专业SEO教程网站广东省住房与城乡建设部网站
  • 360免费建站为什么注册不了雨灿网站建设
  • 益阳市建设局网站在家来料加工
  • 邵阳网站设计宠物网站 html模板
  • 网站域名以co与com有什么不同18款禁用黄a免费
  • 农村电商网站建设方案wordpress官网密码错误
  • 婚庆公司网站建设doc高端网站建设推广
  • 做房地产一级市场的看什么网站网站建建设公司和网络自建
  • 搞一个网站要多少钱长治做网站哪家好
  • 德州口碑好的网站制作公司网站运营托管咨询
  • 东阳网站建设价格广州最好的网站设计
  • 襄垣网站建设宝塔面板怎么搭建网站
  • 电影网站源码access广州网站建设排名一览表
  • 做论坛网站多少钱企业做网站有用吗天涯
  • 做网站价格多少钱网站设计培训课程
  • 做网站找什么公司好淘宝客网站可以做百度推广
  • 北京网站建设首选石榴汇企业vi设计一整套
  • 做网站较好的公司c 网站开发培训
  • 一个云主机怎么挂两个网站建立网站要准备多少钱
  • 贵阳网站建设在线学做凉菜冷菜的网站