[Python-Dev] test_fork1 on SMP? (was Re: [Python Dev] test_fork1 failing --with-threads (for some people)...)
Neil Schemenauer
nascheme@enme.ucalgary.ca
Thu, 27 Jul 2000 07:50:58 -0600
On Thu, Jul 27, 2000 at 01:17:03AM -0400, Tim Peters wrote:
> If there exists a platform on which it fails but it doesn't fail every time
> on that platform, that would be strong evidence of a timing hole. Those
> usually require <gasp!> thought to identify and repair. I'll voluteer to
> eyeball the code and do some thinking, but not unless the symptoms suggest
> that's worthwhile.
>
> ignorantly y'rs - tim
Here is some code that seems to hang on Linux UP machines. Sometimes it prints
PIDS for a while and other times it stops after only a few. I don't know if
that counts. I raised this issue over a month ago. Tim, your getting
forgetful. :)
Neil
import threading
import os, sys
class MyThread(threading.Thread):
def start(self):
threading.Thread.start(self)
def run(self):
while 1:
if os.fork() == 0:
print os.getpid()
os._exit(0)
os.wait()
MyThread().start()
MyThread().start()
MyThread().start()