[SailfishDevel] QThread priority
Krisztian Olah
fasza2mobile at gmail.com
Thu May 29 22:53:21 UTC 2014
Andrey, you are right if I'm not using the signals/slots, but calling it
directly causes it to run in current thread. It works just fine now, thanks.
Denis, I did check out QtConcurrent::run(), but since I return void from
the function and I have to call the function multiple times possibly in the
same thread so that I can append to QXmlStreamReader's data, I think it is
easier to just use QThread in this case. However thank you for your input,
I'm sure I will make use of QtConcurrent in the QFuture. (pun intended) ;)
On 29 May 2014 12:23, Krisztian Olah <fasza2mobile at gmail.com> wrote:
> Thanks Denis, I'll look into QtConcurrent + QFutureWatcher tonight when
> I'll have time. I will also consult pthread's documentation after comparing
> the two approaches.
>
> Thanks again
> Kris
>
>
> On 29 May 2014 11:01, Denis Zalevskiy <denis.zalevskiy at jollamobile.com>
> wrote:
>
>> On Thursday 29 May 2014 13:55:40 Denis Zalevskiy wrote:
>> > To run parser in parallel just to get results in the main thread it is
>> > better to use QtConcurrent::run() + QFutureWatcher.
>> >
>>
>> Also, to set priority I guess you can use posix pthread functions, smth.
>> like
>>
>> ::pthread_setschedprio(::pthread_self(), SCHED_IDLE);
>>
>> - denis
>>
>> > - denis
>> >
>> > > > Thanks again
>> > > > Kris
>> > > >
>> > > >
>> > > > On 28 May 2014 06:16, Andrey Kozhevnikov <coderusinbox at gmail.com
>> > > >
>> > > > <mailto:coderusinbox at gmail.com>> wrote:
>> > > > it can't "doesn't help much". you initializing thread wrong.
>> > > >
>> > > > simple threading way is:
>> > > >
>> > > > MyXmlParser *parser = new MyXmlParser(xmlDocument);
>> > > > QThread *thread = new QThread(parser);
>> > > > parser->moveToThread(thread);
>> > > > QObject::connect(thread, SIGNAL(started()), parser,
>> SLOT(parse()));
>> > > > QObject::connect(parser, SIGNAL(parseComplete(QVariantMap)),
>> this,
>> > > > SLOT(onParseComplete(QVariantMap)));
>> > > > thread->start();
>> > > >
>> > > > 28.05.2014 03:24, Krisztian Olah ?????:
>> > > >> Hi list,
>> > > >>
>> > > >> I have a rather large xml file to parse and it causes the UI
>> to
>> > > >>
>> > > >> freeze, I assingned the parser to a different thread, but it
>> > > >> doesn't help much. According to the Qt documentation
>> > > >> QThread::setPriority() doesn't work on Linux, is there some
>> kind
>> > > >> of workaround that could be used?
>> > > >>
>> > > >> Thanks
>> > > >> Kris
>> > > >>
>> > > >>
>> > > >> _______________________________________________
>> > > >> SailfishOS.org Devel mailing list
>> > > >> To unsubscribe, please send a mail
>> > > >> todevel-unsubscribe at lists.sailfishos.org
>> > > >> <mailto:devel-unsubscribe at lists.sailfishos.org>>
>> > > >
>> > > > _______________________________________________
>> > > > SailfishOS.org Devel mailing list
>> > > > To unsubscribe, please send a mail to
>> > > > devel-unsubscribe at lists.sailfishos.org
>> > > > <mailto:devel-unsubscribe at lists.sailfishos.org>
>> > > >
>> > > > _______________________________________________
>> > > > SailfishOS.org Devel mailing list
>> > > > To unsubscribe, please send a mail to
>> > > > devel-unsubscribe at lists.sailfishos.org
>> >
>> > _______________________________________________
>> > SailfishOS.org Devel mailing list
>> > To unsubscribe, please send a mail to
>> devel-unsubscribe at lists.sailfishos.org
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscribe at lists.sailfishos.org
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140529/264faf56/attachment-0001.html>
More information about the Devel
mailing list