QNetworkAccessManager from ThreadPool

后端 未结 2 454
-上瘾入骨i
-上瘾入骨i 2021-01-19 19:20

A very fundamental question. The documentation mentions that all methods in QNetworkAccessManager are reentrant. If so, is performing a get() metho

相关标签:
2条回答
  • 2021-01-19 19:49

    From the Qt documentation:

    [...] a class is said to be reentrant if its member functions can [simultaneously] be called safely from multiple threads, as long as each thread uses a different instance of the class.

    Since you're using a different instance each time (the one you create on the stack in run()), you're on the safe side.

    0 讨论(0)
  • 2021-01-19 19:53

    As a side note to this ,if you just want the GET request to be asynchronous, QNetworkAccessManager is already asynchronous (says so in the docs).

    0 讨论(0)
提交回复
热议问题