Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78268
| From | dieter <dieter@handshake.de> |
|---|---|
| Subject | Re: Dynamically swapping between two algorithms |
| Date | 2014-09-24 09:44 +0200 |
| References | <54218831$0$29979$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14300.1411544681.18130.python-list@python.org> (permalink) |
Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes: > ... > *If* Python was a different language, I would spawn two threads, one using > SHORT and the other using LARGE, then which ever completes first, I'd just > kill the other. Alas, this won't work because (1) the GIL The GIL does not prevent this scenario. The two threads will not really run in parallel but interleaved - but this should not be a big problem. > and (2) you > cannot forcibly kill threads, only ask them to die and hope they listen. You can kill threads (though you will need a "C" level function for this) as long as they execute Python code. And it is your code: you can make your threads be listening, from time to time in the computation.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Dynamically swapping between two algorithms Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-24 00:48 +1000 Re: Dynamically swapping between two algorithms Chris Angelico <rosuav@gmail.com> - 2014-09-24 01:24 +1000 Re: Dynamically swapping between two algorithms emile <emile@fenx.com> - 2014-09-23 08:33 -0700 Re: Dynamically swapping between two algorithms MRAB <python@mrabarnett.plus.com> - 2014-09-23 16:42 +0100 Re: Dynamically swapping between two algorithms Terry Reedy <tjreedy@udel.edu> - 2014-09-23 15:21 -0400 Re: Dynamically swapping between two algorithms C Smith <illusiontechniques@gmail.com> - 2014-09-23 13:54 -0700 Re: Dynamically swapping between two algorithms dieter <dieter@handshake.de> - 2014-09-24 09:44 +0200 Re: Dynamically swapping between two algorithms Cameron Simpson <cs@zip.com.au> - 2014-09-26 10:30 +1000 Re: Dynamically swapping between two algorithms Ethan Furman <ethan@stoneleaf.us> - 2014-09-25 20:11 -0700
csiph-web