Following some bug hunting, I have written an update on the blog post mentioned in my previous message. I think it shows very clearly how the borg interpreters do indeed share a common state - and how unexpected result can happen when working with communicating threads (even those that were supposed to properly use lock and release...).
I'd be interested in getting comments from those that try it out. André On 7/17/07, Andre Roberge <[EMAIL PROTECTED]> wrote: > For those that happen to have downloaded Crunchy (version 0.9x), I > have posted a very simple example[1] that illustrate some properties > of threads, and possible interactions between them. > > http://crunchypython.blogspot.com/2007/07/unending-loops-and-magic-of-threads.html > > The idea of threads is something that should be accessible to anyone > familiar with using a computer. However, I can not think of a simpler > example in any Python environment to demonstrate > 1. How threads can allow different parts of a program to work > independently - in this case, two different Python interpreters. > 2. How interactions between threads make certain things (like breaking > of an infinite loop) possible which would not be using a single > thread. > > Of course, the user has to take the teacher's word (or mine) for it > when it is stated that the two Python interpreters are running in > separate threads. > > André > > [1]... and, as is often the case, this example has uncovered a "small" > bug with Crunchy which you might get to see... > _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
