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


Groups > comp.lang.python > #63406

Re: Trying to wrap my head around futures and coroutines

Date 2014-01-07 13:45 +1100
From Cameron Simpson <cs@zip.com.au>
Subject Re: Trying to wrap my head around futures and coroutines
References <20140107022958.GA59457@cskk.homeip.net>
Newsgroups comp.lang.python
Message-ID <mailman.5115.1389062734.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 07Jan2014 13:29, I wrote:
>   def do_A():
>     with lock_B():
>       with lock_A():
>         _do_A()

Um, of course there would be a cancel_B() up front above, like this:

  def do_A():
    cancel_B()
    with lock_B():
      with lock_A():
        _do_A()

I'm with MRAB: you don't really need futures unless you looking to
move to a multithreaded appraoch and aren't multithreaded already.
Even then, you don't need futures, just track running threads and
what's meant to run next.

You can do all your blocking with Locks fairly easily unless there
are complexities not yet revealed. (Of course, this is a truism,
but I mean "conveniently".)

Cheers,
-- 
Cameron Simpson <cs@zip.com.au>

Follow! But! Follow only if ye be men of valor, for the entrance to this cave
is guarded by a creature so foul, so cruel that no man yet has fought with it
and lived! Bones of four fifty men lie strewn about its lair.  So,
brave knights, if you do doubt your courage or your strength, come no
further, for death awaits you all with nasty big pointy teeth.
- Tim The Enchanter

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


Thread

Re: Trying to wrap my head around futures and coroutines Cameron Simpson <cs@zip.com.au> - 2014-01-07 13:45 +1100

csiph-web