Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > A possible bug in python threading/time module?

Thread Tools

A possible bug in python threading/time module?

Posts: n/a
Hi everyone,

I've been running this segment of code (slightly simplified to
emphasize the main part):

----START of Script----

import time
import threading

sem = threading.Semaphore(204

class MyThread(threading.Thread):
def __init__(self):

def run(self):
j = 0
for i in range(1000):
j = j+1

for i in range(4096):

----END of Script----

I ran it on python 2.2.2 and python 2.3b1, and on both all of the
threads started successfully, acquiring the semaphore until 0
resources were left.
However, about 10-20 threads remain active after a while (and the
semaphore is lacking resources, respectively). I waited for about two
hours, and nothing changed - it appears to be hanging. Did anyone
encounter this behaviour before?
Am I the only one who ran into this situation? Is this a bug?

Thanx in advance

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[BUG] Ruby 1.9.0: possible bug when subclassing BasicObject Michael Fellinger Ruby 3 12-27-2007 04:05 PM
efficient data loading with Python, is that possible possible? Python 10 12-14-2007 04:44 PM
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
RE: A possible bug in python threading/time module? Tim Peters Python 6 07-06-2003 06:04 PM
Re: Possible fix for Bug 494589 - os.path.expandvars bug Steve Holden Python 1 07-02-2003 09:42 PM