Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68458 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2014-03-17 14:05 -0600 |
| Last post | 2014-03-17 14:05 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Thread._stop() behavior changed in Python 3.4 Ian Kelly <ian.g.kelly@gmail.com> - 2014-03-17 14:05 -0600
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-03-17 14:05 -0600 |
| Subject | Re: Thread._stop() behavior changed in Python 3.4 |
| Message-ID | <mailman.8221.1395086768.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
On Mar 17, 2014 12:53 PM, "Jurko Gospodnetić" <jurko.gospodnetic@pke.hr> wrote: > > Hi. > > > On 17.3.2014. 19:03, Ian Kelly wrote: >> >> So yes, despite the lack of true concurrency, a thread can continue to >> run after its _stop has been called. > > > Actually 'true' or 'false' concurrency does not matter here. > > CPython supports multiple threads and implements them using underlying native OS threads. The fact that it has an internal mutex (GIL) preventing it from executing/interpreting Python code at the same time in multiple threads (most of the time) does not come into play.. When one thread exits its GIL protected section (e.g. finishes processing one bytecode instruction and is about to go on to processing the next one), another thread may pick up the GIL and do some of its work, e.g. print out some output. Yes, and whenever a thread acquires the GIL it *could* check whether its _stop flag has been set before it starts executing any Python code. Apparently though it does not, perhaps for performance reasons.
Back to top | Article view | comp.lang.python
csiph-web