Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82638

Re: PyQt: user interface freezed when using concurrent.futures.ThreadPoolExecutor

Date 2014-12-18 09:29 -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> <4f2a19ce-7642-4beb-9dd6-7771c6237a3f@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.17032.1418920169.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 12/18/2014 04:16 AM, Mark Summerfield wrote:
> It looks to me that what you are doing is sharing a single core
> between your GUI and your processing. Threading isn't usually a good
> approach to Python concurrency that is CPU-bound.

Except that his code was not CPU-bound to begin with.  His real problem
is that his callback is starting *and* waiting for all the threads to do
their work without returning to the main loop, thus blocking the GUI.
As for the threads, they are I/O bound--he's simply trying to do
concurrent HTTP downloads.  So blocking in the GIL is not the issue
here.  In fact, in lieu of using proper asynchronous I/O, threading of
some kind is probably not a bad solution here, but he has to do it
within the Qt Framework, using signals to notify the GUI when a thread
is finished, or using a synchronization primitive such as a queue, as
recommended by your book in fact.

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


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