ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #19057
Re: SDK planning
Hi Omer,
if you are implementing your network handling code in C++ anyway then
threads
are very rarely needed as long as you implement it asynchonously. You
should
never block the main thread, ever.
However when you decide you want to do that inside a thread, checkout
the QRunnable[1] and
QThreadPool[2] classes. Using NetworkManger in another thread should be
straightforward.
When you need to transfer something between threads use signals and
slots as they
are threadsafe by default [3].
[1] http://doc.qt.io/qt-5/qrunnable.html
[2] http://doc.qt.io/qt-5/qthreadpool.html
[3]
http://doc.qt.io/qt-5/threads-qobject.html#signals-and-slots-across-threads
On 03/22/2016 09:42 PM, Omer Akram wrote:
Hi Zsombor,
While implementing network operations I went with the
QNetworkAccessManager as I was doing other stuff in c++ as well, but
will take a note about WorkerScripts.
Thanks
On Sun, Mar 20, 2016 at 10:03 PM, Zsombor Egri
<zsombor.egri@xxxxxxxxxxxxx <mailto:zsombor.egri@xxxxxxxxxxxxx>> wrote:
On Sun, Mar 20, 2016 at 12:25 PM, Omer Akram <om26er@xxxxxxxxxx
<mailto:om26er@xxxxxxxxxx>> wrote:
Android provides AsyncTask[1] to do exactly that. So basically
it provides a few override methods
You have the WorkerScripts [1] doing multithreading in your QML.
See an example [2] how it works.
[1] http://doc.qt.io/qt-5/qml-workerscript.html
[2] http://doc.qt.io/qt-5/qtquick-threading-example.html
References