[Interest] 答复: 答复: how to block run function of QRunnable class

Amogh Kudari amogh.kudari5 at gmail.com
Tue Mar 19 06:44:20 CET 2013


Hi,

Yes its also present in Qt4. I checked Qt4.8.2
source.(qt4.8.2/src/corelib/concurrent/qthreadpool.cpp).

Regards,
Amogh.



On Tue, Mar 19, 2013 at 11:06 AM, pengliang(彭亮) <pengliang at founder.com>wrote:

>  Hi****
>
> I am sorry, I use Qt4.****
>
> So, anybody know?****
>
> ** **
>
> Thanks****
>
> Ken****
>
> ** **
>
> ** **
>  ------------------------------
>
> *发件人:* Amogh Kudari [mailto:amogh.kudari5 at gmail.com]
> *发送时间:* 2013年3月19日 13:31
> *收件人:* pengliang(彭亮)
> *抄送:* Interest at qt-project.org
> *主题:* Re: 答复: [Interest] how to block run function of QRunnable class****
>
>  ** **
>
> Hi Pengliang,****
>
> ** **
>
>         It's *not **QthreadPool*  I referred to. Its *QThreadPoolThread *which
> is derived from QThread. I am referring QT5.0.****
>
> ** **
>
> //QThreadpool.cpp****
>
> /*****
>
>     QThread wrapper, provides synchronizitaion against a ThreadPool****
>
> */****
>
> class *QThreadPoolThread *: public *QThread*****
>
> {****
>
> public:****
>
>     QThreadPoolThread(QThreadPoolPrivate *manager);****
>
>     void run();****
>
>     void registerTheadInactive();****
>
> ** **
>
>     QThreadPoolPrivate *manager;****
>
>     QRunnable *runnable;****
>
> };****
>
> ** **
>
> and ****
>
> ** **
>
> //QThread.h****
>
> ** **
>
> class Q_CORE_EXPORT QThread : public QObject****
>
> {****
>
>      ........****
>
> public:****
>
>     // default argument causes thread to block indefinetely****
>
>     bool wait(unsigned long time = ULONG_MAX);****
>
> ** **
>
>     static void sleep(unsigned long);****
>
>     static void msleep(unsigned long);****
>
>     static void usleep(unsigned long);****
>
> ** **
>
> ........****
>
> };****
>
> ** **
>
> Hope this helps.****
>
> ** **
>
> ** **
>
> Regards,****
>
> Amogh.****
>
> ** **
>
> On Tue, Mar 19, 2013 at 10:52 AM, pengliang(彭亮) <pengliang at founder.com>
> wrote:****
>
> Hi****
>
>          Thank you.****
>
> But I check source code of Qt, QthreadPool is derived from Qobject, not
> Qthread.****
>
>  ****
>
>  ****
>
> Thanks****
>
> Ken****
>
>  ****
>
>  ****
>
>  ****
>  ------------------------------
>
> *发件人:* Amogh Kudari [mailto:amogh.kudari5 at gmail.com]
> *发送时间:* 2013年3月19日 11:53
> *收件人:* pengliang(彭亮)
> *抄送:* Interest at qt-project.org
> *主题:* Re: [Interest] how to block run function of QRunnable class****
>
>  ****
>
> Hi Pengliang,****
>
>  ****
>
>       I am not pretty sure but it may be possible as QThreadPoolThread is
> a friend class of Qrunnable class and ****
>
> QThreadPoolThread is derived from QThread and QThread has the sleep method.
> ****
>
> Hope this helps.****
>
>  ****
>
> Regards,****
>
> Amogh.****
>
>  ****
>
> On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) <pengliang at founder.com>
> wrote:****
>
> Hi all****
>
>          I don’t know how to block run function several seconds of
> Qrunnable class.****
>
>  ****
>
> Andybody know?****
>
>  ****
>
>  ****
>
> Thanks****
>
> Ken****
>
>  ****
>
>  ****
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest****
>
>  ****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130319/fabd70d8/attachment.html>


More information about the Interest mailing list