Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82412
| Date | 2014-12-11 23:07 -0700 |
|---|---|
| From | Michael Torrie <torriem@gmail.com> |
| Subject | Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor |
| References | <c9113f8e-ab16-4226-bd68-28c56a88aeda@googlegroups.com> <mailman.16842.1418275530.18130.python-list@python.org> <7e85a815-fd77-417a-9a5c-20537a83afcf@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16892.1418364458.18130.python-list@python.org> (permalink) |
On 12/11/2014 08:20 PM, iMath wrote: > 在 2014年12月11日星期四UTC+8下午1时25分41秒,Michael Torrie写道: >> On 12/10/2014 09:52 PM, iMath wrote: > "when it comes to I/O and GUIs, asynchronous calls are always better than threads." > > I cannot grasp your meaning here, IMO, asynchronous calls are done by using threads. Not in your code. All your I/O calls are synchronous; they block until they are finished. But if you mean that calling synchronous calls while in a thread has a similar effect to an asynchronous call, you are correct. But the way you're waiting for the threads to finish, you're blocking your gui. An asynchronous API lets you start long-running I/O calls and define a function that is automatically called upon completion. In other words it's event-driven. Qt may provide everything you need already in an asynchronous form. Check the docs. And use google. Here's a link I found from a google search that illustrates how to fetch a url in Qt using an asynchronous method. You could fire off as many of these as you want, then just wait for signals. http://qt-project.org/wiki/Download_Data_from_URL
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor iMath <redstone-cold@163.com> - 2014-12-10 20:52 -0800
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Michael Torrie <torriem@gmail.com> - 2014-12-10 22:25 -0700
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor iMath <redstone-cold@163.com> - 2014-12-11 19:20 -0800
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Michael Torrie <torriem@gmail.com> - 2014-12-11 23:07 -0700
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 09:18 +0200
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Chris Angelico <rosuav@gmail.com> - 2014-12-12 18:42 +1100
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Marko Rauhamaa <marko@pacujo.net> - 2014-12-12 10:43 +0200
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Mark Summerfield <list@qtrac.plus.com> - 2014-12-18 03:16 -0800
Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor Michael Torrie <torriem@gmail.com> - 2014-12-18 09:29 -0700
csiph-web