/usr/lib64/python2.6
NameSizeModeActions
bsddb/-0755rm
compiler/-0755rm
config/-0755rm
ctypes/-0755rm
curses/-0755rm
Demo/-0755rm
distutils/-0755rm
Doc/-0755rm
email/-0755rm
encodings/-0755rm
hotshot/-0755rm
idlelib/-0755rm
json/-0755rm
lib-dynload/-0755rm
lib-tk/-0755rm
lib2to3/-0755rm
logging/-0755rm
multiprocessing/-0755rm
plat-linux2/-0755rm
site-packages/-0755rm
sqlite3/-0755rm
test/-0755rm
Tools/-0755rm
wsgiref/-0755rm
xml/-0755rm
abc.py70340644editdlrm
abc.pyc60710644editdlrm
abc.pyo60130644editdlrm
aifc.py331880644editdlrm
aifc.pyc295640644editdlrm
aifc.pyo295640644editdlrm
anydbm.py26200644editdlrm
anydbm.pyc27750644editdlrm
anydbm.pyo27750644editdlrm
ast.py113470644editdlrm
ast.pyc127800644editdlrm
ast.pyo127800644editdlrm
asynchat.py114020644editdlrm
asynchat.pyc87370644editdlrm
asynchat.pyo87370644editdlrm
asyncore.py200610644editdlrm
asyncore.pyc184520644editdlrm
asyncore.pyo184520644editdlrm
atexit.py17050644editdlrm
atexit.pyc22150644editdlrm
atexit.pyo22150644editdlrm
audiodev.py75970644editdlrm
audiodev.pyc85370644editdlrm
audiodev.pyo85370644editdlrm
base64.py113350755editdlrm
base64.pyc110030644editdlrm
base64.pyo110030644editdlrm
BaseHTTPServer.py219740644editdlrm
BaseHTTPServer.pyc215750644editdlrm
BaseHTTPServer.pyo215750644editdlrm
Bastion.py57440644editdlrm
Bastion.pyc66670644editdlrm
Bastion.pyo66670644editdlrm
bdb.py205970644editdlrm
bdb.pyc185670644editdlrm
bdb.pyo185670644editdlrm
binhex.py148780644editdlrm
binhex.pyc158750644editdlrm
binhex.pyo158750644editdlrm
bisect.py26620644editdlrm
bisect.pyc31730644editdlrm
bisect.pyo31730644editdlrm
calendar.py231100644editdlrm
calendar.pyc281650644editdlrm
calendar.pyo281650644editdlrm
cgi.py344780755editdlrm
cgi.pyc328180644editdlrm
cgi.pyo328180644editdlrm
CGIHTTPServer.py127730644editdlrm
CGIHTTPServer.pyc108200644editdlrm
CGIHTTPServer.pyo108200644editdlrm
cgitb.py121550644editdlrm
cgitb.pyc124610644editdlrm
cgitb.pyo124610644editdlrm
chunk.py53720644editdlrm
chunk.pyc56450644editdlrm
chunk.pyo56450644editdlrm
cmd.py149620644editdlrm
cmd.pyc139540644editdlrm
cmd.pyo139540644editdlrm
code.py102170644editdlrm
code.pyc104270644editdlrm
code.pyo104270644editdlrm
codecs.py352660644editdlrm
codecs.pyc367210644editdlrm
codecs.pyo367210644editdlrm
codeop.py59990644editdlrm
codeop.pyc66360644editdlrm
codeop.pyo66360644editdlrm
collections.py137300644editdlrm
collections.pyc144620644editdlrm
collections.pyo144090644editdlrm
colorsys.py34590644editdlrm
colorsys.pyc40410644editdlrm
colorsys.pyo40410644editdlrm
commands.py25430644editdlrm
commands.pyc24890644editdlrm
commands.pyo24890644editdlrm
compileall.py52850644editdlrm
compileall.pyc49970644editdlrm
compileall.pyo49970644editdlrm
ConfigParser.py259890644editdlrm
ConfigParser.pyc238650644editdlrm
ConfigParser.pyo238650644editdlrm
contextlib.py41360644editdlrm
contextlib.pyc41510644editdlrm
contextlib.pyo41510644editdlrm
Cookie.py250540644editdlrm
Cookie.pyc221450644editdlrm
Cookie.pyo221450644editdlrm
cookielib.py647260644editdlrm
cookielib.pyc553700644editdlrm
cookielib.pyo551790644editdlrm
copy.py111770644editdlrm
copy.pyc116750644editdlrm
copy.pyo115790644editdlrm
copy_reg.py68000644editdlrm
copy_reg.pyc51780644editdlrm
copy_reg.pyo51320644editdlrm
cProfile.py63370755editdlrm
cProfile.pyc62390644editdlrm
cProfile.pyo62390644editdlrm
crypt.py22290644editdlrm
crypt.pyc30550644editdlrm
crypt.pyo30550644editdlrm
csv.py157300644editdlrm
csv.pyc132260644editdlrm
csv.pyo132260644editdlrm
dbhash.py5350644editdlrm
dbhash.pyc7600644editdlrm
dbhash.pyo7600644editdlrm
decimal.py1992730644editdlrm
decimal.pyc1556810644editdlrm
decimal.pyo1556150644editdlrm
difflib.py810800644editdlrm
difflib.pyc611930644editdlrm
difflib.pyo611390644editdlrm
dircache.py11260644editdlrm
dircache.pyc15840644editdlrm
dircache.pyo15840644editdlrm
dis.py64490644editdlrm
dis.pyc63660644editdlrm
dis.pyo63660644editdlrm
doctest.py1015160644editdlrm
doctest.pyc809940644editdlrm
doctest.pyo807060644editdlrm
DocXMLRPCServer.py105990644editdlrm
DocXMLRPCServer.pyc99570644editdlrm
DocXMLRPCServer.pyo98490644editdlrm
dumbdbm.py88200644editdlrm
dumbdbm.pyc65850644editdlrm
dumbdbm.pyo65850644editdlrm
dummy_thread.py44180644editdlrm
dummy_thread.pyc54130644editdlrm
dummy_thread.pyo54130644editdlrm
dummy_threading.py28040644editdlrm
dummy_threading.pyc12970644editdlrm
dummy_threading.pyo12970644editdlrm
filecmp.py94700644editdlrm
filecmp.pyc96320644editdlrm
filecmp.pyo96320644editdlrm
fileinput.py141430644editdlrm
fileinput.pyc149280644editdlrm
fileinput.pyo149280644editdlrm
fnmatch.py32390644editdlrm
fnmatch.pyc35790644editdlrm
fnmatch.pyo35790644editdlrm
formatter.py149110644editdlrm
formatter.pyc193030644editdlrm
formatter.pyo193030644editdlrm
fpformat.py46990644editdlrm
fpformat.pyc47350644editdlrm
fpformat.pyo47350644editdlrm
fractions.py200730644editdlrm
fractions.pyc181190644editdlrm
fractions.pyo181190644editdlrm
ftplib.py291970644editdlrm
ftplib.pyc285030644editdlrm
ftplib.pyo285030644editdlrm
functools.py21620644editdlrm
functools.pyc19270644editdlrm
functools.pyo19270644editdlrm
genericpath.py30200644editdlrm
genericpath.pyc32920644editdlrm
genericpath.pyo32920644editdlrm
getopt.py73280644editdlrm
getopt.pyc67300644editdlrm
getopt.pyo66830644editdlrm
getpass.py55340644editdlrm
getpass.pyc47540644editdlrm
getpass.pyo47540644editdlrm
gettext.py199680644editdlrm
gettext.pyc157600644editdlrm
gettext.pyo157600644editdlrm
glob.py22490644editdlrm
glob.pyc24090644editdlrm
glob.pyo24090644editdlrm
gzip.py167540644editdlrm
gzip.pyc143860644editdlrm
gzip.pyo143860644editdlrm
hashlib.py44270644editdlrm
hashlib.pyc39810644editdlrm
hashlib.pyo39810644editdlrm
heapq.py159950644editdlrm
heapq.pyc126940644editdlrm
heapq.pyo126940644editdlrm
hmac.py45310644editdlrm
hmac.pyc45090644editdlrm
hmac.pyo45090644editdlrm
htmlentitydefs.py180540644editdlrm
htmlentitydefs.pyc63710644editdlrm
htmlentitydefs.pyo63710644editdlrm
htmllib.py128690644editdlrm
htmllib.pyc203840644editdlrm
htmllib.pyo203840644editdlrm
HTMLParser.py135760644editdlrm
HTMLParser.pyc122580644editdlrm
HTMLParser.pyo119500644editdlrm
httplib.py487970644editdlrm
httplib.pyc377320644editdlrm
httplib.pyo375360644editdlrm
ihooks.py174520644editdlrm
ihooks.pyc208370644editdlrm
ihooks.pyo207580644editdlrm
imaplib.py477710644editdlrm
imaplib.pyc452250644editdlrm
imaplib.pyo424750644editdlrm
imghdr.py35440644editdlrm
imghdr.pyc49050644editdlrm
imghdr.pyo49050644editdlrm
imputil.py260090644editdlrm
imputil.pyc160370644editdlrm
imputil.pyo158650644editdlrm
inspect.py381890644editdlrm
inspect.pyc371650644editdlrm
inspect.pyo371650644editdlrm
io.py661650644editdlrm
io.pyc630420644editdlrm
io.pyo630420644editdlrm
keyword.py19970755editdlrm
keyword.pyc21170644editdlrm
keyword.pyo21170644editdlrm
linecache.py41280644editdlrm
linecache.pyc32680644editdlrm
linecache.pyo32680644editdlrm
locale.py826740644editdlrm
locale.pyc466760644editdlrm
locale.pyo466760644editdlrm
macpath.py62530644editdlrm
macpath.pyc77070644editdlrm
macpath.pyo77070644editdlrm
macurl2path.py32750644editdlrm
macurl2path.pyc28250644editdlrm
macurl2path.pyo28250644editdlrm
mailbox.py758240644editdlrm
mailbox.pyc760690644editdlrm
mailbox.pyo760200644editdlrm
mailcap.py84020644editdlrm
mailcap.pyc80790644editdlrm
mailcap.pyo80790644editdlrm
markupbase.py143500644editdlrm
markupbase.pyc94640644editdlrm
markupbase.pyo92700644editdlrm
md5.py4100644editdlrm
md5.pyc3780644editdlrm
md5.pyo3780644editdlrm
mhlib.py334340644editdlrm
mhlib.pyc341370644editdlrm
mhlib.pyo341370644editdlrm
mimetools.py71680644editdlrm
mimetools.pyc83200644editdlrm
mimetools.pyo83200644editdlrm
mimetypes.py188220644editdlrm
mimetypes.pyc168720644editdlrm
mimetypes.pyo168720644editdlrm
MimeWriter.py64820644editdlrm
MimeWriter.pyc73830644editdlrm
MimeWriter.pyo73830644editdlrm
mimify.py150240755editdlrm
mimify.pyc122190644editdlrm
mimify.pyo122190644editdlrm
modulefinder.py242830644editdlrm
modulefinder.pyc190070644editdlrm
modulefinder.pyo189190644editdlrm
multifile.py48200644editdlrm
multifile.pyc54790644editdlrm
multifile.pyo54350644editdlrm
mutex.py18660644editdlrm
mutex.pyc25260644editdlrm
mutex.pyo25260644editdlrm
netrc.py41110644editdlrm
netrc.pyc36020644editdlrm
netrc.pyo36020644editdlrm
new.py7060644editdlrm
new.pyc9100644editdlrm
new.pyo9100644editdlrm
nntplib.py214700644editdlrm
nntplib.pyc211790644editdlrm
nntplib.pyo211790644editdlrm
ntpath.py177520644editdlrm
ntpath.pyc116200644editdlrm
ntpath.pyo115730644editdlrm
nturl2path.py22390644editdlrm
nturl2path.pyc17770644editdlrm
nturl2path.pyo17770644editdlrm
numbers.py102710644editdlrm
numbers.pyc139640644editdlrm
numbers.pyo139640644editdlrm
opcode.py52480644editdlrm
opcode.pyc59170644editdlrm
opcode.pyo59170644editdlrm
optparse.py608490644editdlrm
optparse.pyc542390644editdlrm
optparse.pyo541570644editdlrm
ordereddict.py360644editdlrm
ordereddict.pyc1850644editdlrm
ordereddict.pyo1850644editdlrm
os.py258020644editdlrm
os.pyc258080644editdlrm
os.pyo258080644editdlrm
os2emxpath.py46030644editdlrm
os2emxpath.pyc45360644editdlrm
os2emxpath.pyo45360644editdlrm
pdb.doc78990644editdlrm
pdb.py453330755editdlrm
pdb.pyc438130644editdlrm
pdb.pyo438130644editdlrm
pickle.py448110644editdlrm
pickle.pyc386450644editdlrm
pickle.pyo384400644editdlrm
pickletools.py743480644editdlrm
pickletools.pyc571430644editdlrm
pickletools.pyo562460644editdlrm
pipes.py96470644editdlrm
pipes.pyc94600644editdlrm
pipes.pyo94600644editdlrm
pkgutil.py200010644editdlrm
pkgutil.pyc190200644editdlrm
pkgutil.pyo190200644editdlrm
platform.py526300755editdlrm
platform.pyc387970644editdlrm
platform.pyo387970644editdlrm
plistlib.py158060644editdlrm
plistlib.pyc200500644editdlrm
plistlib.pyo199600644editdlrm
popen2.py84160644editdlrm
popen2.pyc90640644editdlrm
popen2.pyo90200644editdlrm
poplib.py128250644editdlrm
poplib.pyc134180644editdlrm
poplib.pyo134180644editdlrm
posixfile.py80030644editdlrm
posixfile.pyc77240644editdlrm
posixfile.pyo77240644editdlrm
posixpath.py131190644editdlrm
posixpath.pyc111880644editdlrm
posixpath.pyo111880644editdlrm
pprint.py119320644editdlrm
pprint.pyc103940644editdlrm
pprint.pyo102190644editdlrm
profile.py235100755editdlrm
profile.pyc166800644editdlrm
profile.pyo164350644editdlrm
pstats.py273100644editdlrm
pstats.pyc253400644editdlrm
pstats.pyo253400644editdlrm
pty.py48690644editdlrm
pty.pyc49190644editdlrm
pty.pyo49190644editdlrm
pyclbr.py132820644editdlrm
pyclbr.pyc97320644editdlrm
pyclbr.pyo97320644editdlrm
pydoc.py924320755editdlrm
pydoc.pyc910520644editdlrm
pydoc.pyo909840644editdlrm
pydoc_topics.py4231260644editdlrm
pydoc_topics.pyc4075880644editdlrm
pydoc_topics.pyo4075880644editdlrm
py_compile.py56330644editdlrm
py_compile.pyc65540644editdlrm
py_compile.pyo65540644editdlrm
Queue.py85740644editdlrm
Queue.pyc94470644editdlrm
Queue.pyo94470644editdlrm
quopri.py69720755editdlrm
quopri.pyc66880644editdlrm
quopri.pyo66880644editdlrm
random.py319660644editdlrm
random.pyc251060644editdlrm
random.pyo251060644editdlrm
re.py129660644editdlrm
re.pyc131640644editdlrm
re.pyo131640644editdlrm
repr.py42960644editdlrm
repr.pyc54340644editdlrm
repr.pyo54340644editdlrm
rexec.py201520644editdlrm
rexec.pyc242200644editdlrm
rexec.pyo242200644editdlrm
rfc822.py332950644editdlrm
rfc822.pyc321100644editdlrm
rfc822.pyo321100644editdlrm
rlcompleter.py58660644editdlrm
rlcompleter.pyc60730644editdlrm
rlcompleter.pyo60730644editdlrm
robotparser.py70140644editdlrm
robotparser.pyc78520644editdlrm
robotparser.pyo78520644editdlrm
runpy.py54130644editdlrm
runpy.pyc39790644editdlrm
runpy.pyo39790644editdlrm
sched.py50910644editdlrm
sched.pyc50050644editdlrm
sched.pyo50050644editdlrm
sets.py190500644editdlrm
sets.pyc169970644editdlrm
sets.pyo169970644editdlrm
sgmllib.py178840644editdlrm
sgmllib.pyc155980644editdlrm
sgmllib.pyo155980644editdlrm
sha.py4450644editdlrm
sha.pyc4210644editdlrm
sha.pyo4210644editdlrm
shelve.py80780644editdlrm
shelve.pyc102960644editdlrm
shelve.pyo102960644editdlrm
shlex.py111370644editdlrm
shlex.pyc77100644editdlrm
shlex.pyo77100644editdlrm
shutil.py86320644editdlrm
shutil.pyc95550644editdlrm
shutil.pyo95550644editdlrm
SimpleHTTPServer.py74220644editdlrm
SimpleHTTPServer.pyc77660644editdlrm
SimpleHTTPServer.pyo77660644editdlrm
SimpleXMLRPCServer.py219920644editdlrm
SimpleXMLRPCServer.pyc196330644editdlrm
SimpleXMLRPCServer.pyo196330644editdlrm
site.py191870644editdlrm
site.pyc188250644editdlrm
site.pyo188250644editdlrm
smtpd.py189200755editdlrm
smtpd.pyc161880644editdlrm
smtpd.pyo161880644editdlrm
smtplib.py309240755editdlrm
smtplib.pyc297370644editdlrm
smtplib.pyo297370644editdlrm
sndhdr.py59730644editdlrm
sndhdr.pyc74200644editdlrm
sndhdr.pyo74200644editdlrm
socket.py201490644editdlrm
socket.pyc161290644editdlrm
socket.pyo160440644editdlrm
SocketServer.py223260644editdlrm
SocketServer.pyc231430644editdlrm
SocketServer.pyo231430644editdlrm
sre.py3840644editdlrm
sre.pyc5190644editdlrm
sre.pyo5190644editdlrm
sre_compile.py165070644editdlrm
sre_compile.pyc114830644editdlrm
sre_compile.pyo113700644editdlrm
sre_constants.py71370644editdlrm
sre_constants.pyc60930644editdlrm
sre_constants.pyo60930644editdlrm
sre_parse.py268780644editdlrm
sre_parse.pyc196960644editdlrm
sre_parse.pyo196960644editdlrm
ssl.py166770644editdlrm
ssl.pyc142760644editdlrm
ssl.pyo142760644editdlrm
stat.py17180644editdlrm
stat.pyc27030644editdlrm
stat.pyo27030644editdlrm
statvfs.py8980644editdlrm
statvfs.pyc6200644editdlrm
statvfs.pyo6200644editdlrm
string.py207450644editdlrm
string.pyc200660644editdlrm
string.pyo200660644editdlrm
StringIO.py106210644editdlrm
StringIO.pyc115320644editdlrm
StringIO.pyo115320644editdlrm
stringold.py124490644editdlrm
stringold.pyc125930644editdlrm
stringold.pyo125930644editdlrm
stringprep.py135220644editdlrm
stringprep.pyc145260644editdlrm
stringprep.pyo144520644editdlrm
struct.py820644editdlrm
struct.pyc2390644editdlrm
struct.pyo2390644editdlrm
subprocess.py579450644editdlrm
subprocess.pyc410710644editdlrm
subprocess.pyo410140644editdlrm
sunau.py165370644editdlrm
sunau.pyc180720644editdlrm
sunau.pyo180720644editdlrm
sunaudio.py13990644editdlrm
sunaudio.pyc19970644editdlrm
sunaudio.pyo19970644editdlrm
symbol.py20500755editdlrm
symbol.pyc30250644editdlrm
symbol.pyo30250644editdlrm
symtable.py79110644editdlrm
symtable.pyc126090644editdlrm
symtable.pyo124790644editdlrm
tabnanny.py113390755editdlrm
tabnanny.pyc83330644editdlrm
tabnanny.pyo83330644editdlrm
tarfile.py877860644editdlrm
tarfile.pyc739220644editdlrm
tarfile.pyo739220644editdlrm
telnetlib.py218080644editdlrm
telnetlib.pyc199130644editdlrm
telnetlib.pyo199130644editdlrm
tempfile.py177740644editdlrm
tempfile.pyc195710644editdlrm
tempfile.pyo195710644editdlrm
textwrap.py168890644editdlrm
textwrap.pyc117920644editdlrm
textwrap.pyo117000644editdlrm
this.py10020644editdlrm
this.pyc12410644editdlrm
this.pyo12410644editdlrm
threading.py318080644editdlrm
threading.pyc281520644editdlrm
threading.pyo260800644editdlrm
timeit.py120030644editdlrm
timeit.pyc118270644editdlrm
timeit.pyo118270644editdlrm
toaiff.py31420644editdlrm
toaiff.pyc31340644editdlrm
toaiff.pyo31340644editdlrm
token.py29470755editdlrm
token.pyc38400644editdlrm
token.pyo38400644editdlrm
tokenize.py163260644editdlrm
tokenize.pyc140180644editdlrm
tokenize.pyo139250644editdlrm
trace.py303250644editdlrm
trace.pyc230510644editdlrm
trace.pyo229890644editdlrm
traceback.py112110644editdlrm
traceback.pyc116770644editdlrm
traceback.pyo116770644editdlrm
tty.py8790644editdlrm
tty.pyc13170644editdlrm
tty.pyo13170644editdlrm
types.py23230644editdlrm
types.pyc26200644editdlrm
types.pyo26200644editdlrm
unittest.py311570644editdlrm
unittest.pyc348620644editdlrm
unittest.pyo348620644editdlrm
urllib.py590220644editdlrm
urllib.pyc513480644editdlrm
urllib.pyo512540644editdlrm
urllib2.py508660644editdlrm
urllib2.pyc458130644editdlrm
urllib2.pyo457190644editdlrm
urlparse.py156180644editdlrm
urlparse.pyc147770644editdlrm
urlparse.pyo147770644editdlrm
user.py16270644editdlrm
user.pyc17360644editdlrm
user.pyo17360644editdlrm
UserDict.py57780644editdlrm
UserDict.pyc88920644editdlrm
UserDict.pyo88920644editdlrm
UserList.py36440644editdlrm
UserList.pyc66030644editdlrm
UserList.pyo66030644editdlrm
UserString.py96910755editdlrm
UserString.pyc149220644editdlrm
UserString.pyo149220644editdlrm
uu.py59420755editdlrm
uu.pyc42370644editdlrm
uu.pyo42370644editdlrm
uuid.py209440644editdlrm
uuid.pyc212790644editdlrm
uuid.pyo212790644editdlrm
warnings.py141720644editdlrm
warnings.pyc130420644editdlrm
warnings.pyo122050644editdlrm
wave.py179520644editdlrm
wave.pyc194360644editdlrm
wave.pyo194360644editdlrm
weakref.py100870644editdlrm
weakref.pyc133750644editdlrm
weakref.pyo133750644editdlrm
webbrowser.py210730644editdlrm
webbrowser.pyc187550644editdlrm
webbrowser.pyo187080644editdlrm
whichdb.py33530644editdlrm
whichdb.pyc22470644editdlrm
whichdb.pyo22470644editdlrm
xdrlib.py55130644editdlrm
xdrlib.pyc91570644editdlrm
xdrlib.pyo91570644editdlrm
xmllib.py348650644editdlrm
xmllib.pyc272740644editdlrm
xmllib.pyo272740644editdlrm
xmlrpclib.py477750644editdlrm
xmlrpclib.pyc414960644editdlrm
xmlrpclib.pyo413130644editdlrm
zipfile.py530920644editdlrm
zipfile.pyc376520644editdlrm
zipfile.pyo376520644editdlrm
_abcoll.py142420644editdlrm
_abcoll.pyc215910644editdlrm
_abcoll.pyo215910644editdlrm
_LWPCookieJar.py65530644editdlrm
_LWPCookieJar.pyc56010644editdlrm
_LWPCookieJar.pyo56010644editdlrm
_MozillaCookieJar.py58090644editdlrm
_MozillaCookieJar.pyc45170644editdlrm
_MozillaCookieJar.pyo44760644editdlrm
_strptime.py197540644editdlrm
_strptime.pyc149660644editdlrm
_strptime.pyo149660644editdlrm
_threading_local.py71140644editdlrm
_threading_local.pyc63850644editdlrm
_threading_local.pyo63850644editdlrm
__future__.py43800644editdlrm
__future__.pyc42330644editdlrm
__future__.pyo42330644editdlrm
__phello__.foo.py640644editdlrm
__phello__.foo.pyc1250644editdlrm
__phello__.foo.pyo1250644editdlrm
Edit: /usr/lib64/python2.6/threading.py (31808B)
"""Thread module emulating a subset of Java's threading model.""" import sys as _sys try: import thread except ImportError: del _sys.modules[__name__] raise import warnings from functools import wraps from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc from collections import deque # Note regarding PEP 8 compliant aliases # This threading model was originally inspired by Java, and inherited # the convention of camelCase function and method names from that # language. While those names are not in any imminent danger of being # deprecated, starting with Python 2.6, the module now provides a # PEP 8 compliant alias for any such method name. # Using the new PEP 8 compliant names also facilitates substitution # with the multiprocessing module, which doesn't provide the old # Java inspired names. # Rename some stuff so "from threading import *" is safe __all__ = ['activeCount', 'active_count', 'Condition', 'currentThread', 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] _start_new_thread = thread.start_new_thread _allocate_lock = thread.allocate_lock _get_ident = thread.get_ident ThreadError = thread.error del thread # sys.exc_clear is used to work around the fact that except blocks # don't fully clear the exception until 3.0. warnings.filterwarnings('ignore', category=DeprecationWarning, module='threading', message='sys.exc_clear') # Debug support (adapted from ihooks.py). # All the major classes here derive from _Verbose. We force that to # be a new-style class so that all the major classes here are new-style. # This helps debugging (type(instance) is more revealing for instances # of new-style classes). _VERBOSE = False if __debug__: class _Verbose(object): def __init__(self, verbose=None): if verbose is None: verbose = _VERBOSE self.__verbose = verbose def _note(self, format, *args): if self.__verbose: format = format % args format = "%s: %s\n" % ( current_thread().name, format) _sys.stderr.write(format) else: # Disable this when using "python -O" class _Verbose(object): def __init__(self, verbose=None): pass def _note(self, *args): pass # Support for profile and trace hooks _profile_hook = None _trace_hook = None def setprofile(func): global _profile_hook _profile_hook = func def settrace(func): global _trace_hook _trace_hook = func # Synchronization classes Lock = _allocate_lock def RLock(*args, **kwargs): return _RLock(*args, **kwargs) class _RLock(_Verbose): def __init__(self, verbose=None): _Verbose.__init__(self, verbose) self.__block = _allocate_lock() self.__owner = None self.__count = 0 def __repr__(self): owner = self.__owner try: owner = _active[owner].name except KeyError: pass return "<%s owner=%r count=%d>" % ( self.__class__.__name__, owner, self.__count) def acquire(self, blocking=1): me = _get_ident() if self.__owner == me: self.__count = self.__count + 1 if __debug__: self._note("%s.acquire(%s): recursive success", self, blocking) return 1 rc = self.__block.acquire(blocking) if rc: self.__owner = me self.__count = 1 if __debug__: self._note("%s.acquire(%s): initial success", self, blocking) else: if __debug__: self._note("%s.acquire(%s): failure", self, blocking) return rc __enter__ = acquire def release(self): if self.__owner != _get_ident(): raise RuntimeError("cannot release un-acquired lock") self.__count = count = self.__count - 1 if not count: self.__owner = None self.__block.release() if __debug__: self._note("%s.release(): final release", self) else: if __debug__: self._note("%s.release(): non-final release", self) def __exit__(self, t, v, tb): self.release() # Internal methods used by condition variables def _acquire_restore(self, count_owner): count, owner = count_owner self.__block.acquire() self.__count = count self.__owner = owner if __debug__: self._note("%s._acquire_restore()", self) def _release_save(self): if __debug__: self._note("%s._release_save()", self) count = self.__count self.__count = 0 owner = self.__owner self.__owner = None self.__block.release() return (count, owner) def _is_owned(self): return self.__owner == _get_ident() def Condition(*args, **kwargs): return _Condition(*args, **kwargs) class _Condition(_Verbose): def __init__(self, lock=None, verbose=None): _Verbose.__init__(self, verbose) if lock is None: lock = RLock() self.__lock = lock # Export the lock's acquire() and release() methods self.acquire = lock.acquire self.release = lock.release # If the lock defines _release_save() and/or _acquire_restore(), # these override the default implementations (which just call # release() and acquire() on the lock). Ditto for _is_owned(). try: self._release_save = lock._release_save except AttributeError: pass try: self._acquire_restore = lock._acquire_restore except AttributeError: pass try: self._is_owned = lock._is_owned except AttributeError: pass self.__waiters = [] def __enter__(self): return self.__lock.__enter__() def __exit__(self, *args): return self.__lock.__exit__(*args) def __repr__(self): return "" % (self.__lock, len(self.__waiters)) def _release_save(self): self.__lock.release() # No state to save def _acquire_restore(self, x): self.__lock.acquire() # Ignore saved state def _is_owned(self): # Return True if lock is owned by current_thread. # This method is called only if __lock doesn't have _is_owned(). if self.__lock.acquire(0): self.__lock.release() return False else: return True def wait(self, timeout=None): if not self._is_owned(): raise RuntimeError("cannot wait on un-acquired lock") waiter = _allocate_lock() waiter.acquire() self.__waiters.append(waiter) saved_state = self._release_save() try: # restore state no matter what (e.g., KeyboardInterrupt) if timeout is None: waiter.acquire() if __debug__: self._note("%s.wait(): got it", self) else: # Balancing act: We can't afford a pure busy loop, so we # have to sleep; but if we sleep the whole timeout time, # we'll be unresponsive. The scheme here sleeps very # little at first, longer as time goes on, but never longer # than 20 times per second (or the timeout time remaining). endtime = _time() + timeout delay = 0.0005 # 500 us -> initial delay of 1 ms while True: gotit = waiter.acquire(0) if gotit: break remaining = endtime - _time() if remaining <= 0: break delay = min(delay * 2, remaining, .05) _sleep(delay) if not gotit: if __debug__: self._note("%s.wait(%s): timed out", self, timeout) try: self.__waiters.remove(waiter) except ValueError: pass else: if __debug__: self._note("%s.wait(%s): got it", self, timeout) finally: self._acquire_restore(saved_state) def notify(self, n=1): if not self._is_owned(): raise RuntimeError("cannot notify on un-acquired lock") __waiters = self.__waiters waiters = __waiters[:n] if not waiters: if __debug__: self._note("%s.notify(): no waiters", self) return self._note("%s.notify(): notifying %d waiter%s", self, n, n!=1 and "s" or "") for waiter in waiters: waiter.release() try: __waiters.remove(waiter) except ValueError: pass def notifyAll(self): self.notify(len(self.__waiters)) notify_all = notifyAll def Semaphore(*args, **kwargs): return _Semaphore(*args, **kwargs) class _Semaphore(_Verbose): # After Tim Peters' semaphore class, but not quite the same (no maximum) def __init__(self, value=1, verbose=None): if value < 0: raise ValueError("semaphore initial value must be >= 0") _Verbose.__init__(self, verbose) self.__cond = Condition(Lock()) self.__value = value def acquire(self, blocking=1): rc = False self.__cond.acquire() while self.__value == 0: if not blocking: break if __debug__: self._note("%s.acquire(%s): blocked waiting, value=%s", self, blocking, self.__value) self.__cond.wait() else: self.__value = self.__value - 1 if __debug__: self._note("%s.acquire: success, value=%s", self, self.__value) rc = True self.__cond.release() return rc __enter__ = acquire def release(self): self.__cond.acquire() self.__value = self.__value + 1 if __debug__: self._note("%s.release: success, value=%s", self, self.__value) self.__cond.notify() self.__cond.release() def __exit__(self, t, v, tb): self.release() def BoundedSemaphore(*args, **kwargs): return _BoundedSemaphore(*args, **kwargs) class _BoundedSemaphore(_Semaphore): """Semaphore that checks that # releases is <= # acquires""" def __init__(self, value=1, verbose=None): _Semaphore.__init__(self, value, verbose) self._initial_value = value def release(self): if self._Semaphore__value >= self._initial_value: raise ValueError, "Semaphore released too many times" return _Semaphore.release(self) def Event(*args, **kwargs): return _Event(*args, **kwargs) class _Event(_Verbose): # After Tim Peters' event class (without is_posted()) def __init__(self, verbose=None): _Verbose.__init__(self, verbose) self.__cond = Condition(Lock()) self.__flag = False def isSet(self): return self.__flag is_set = isSet def set(self): self.__cond.acquire() try: self.__flag = True self.__cond.notify_all() finally: self.__cond.release() def clear(self): self.__cond.acquire() try: self.__flag = False finally: self.__cond.release() def wait(self, timeout=None): self.__cond.acquire() try: if not self.__flag: self.__cond.wait(timeout) finally: self.__cond.release() # Helper to generate new thread names _counter = 0 def _newname(template="Thread-%d"): global _counter _counter = _counter + 1 return template % _counter # Active thread administration _active_limbo_lock = _allocate_lock() _active = {} # maps thread id to Thread object _limbo = {} # Main class for threads class Thread(_Verbose): __initialized = False # Need to store a reference to sys.exc_info for printing # out exceptions when a thread tries to use a global var. during interp. # shutdown and thus raises an exception about trying to perform some # operation on/with a NoneType __exc_info = _sys.exc_info # Keep sys.exc_clear too to clear the exception just before # allowing .join() to return. __exc_clear = _sys.exc_clear def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None): assert group is None, "group argument must be None for now" _Verbose.__init__(self, verbose) if kwargs is None: kwargs = {} self.__target = target self.__name = str(name or _newname()) self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daemon() self.__ident = None self.__started = Event() self.__stopped = False self.__block = Condition(Lock()) self.__initialized = True # sys.stderr is not stored in the class like # sys.exc_info since it can be changed between instances self.__stderr = _sys.stderr def _set_daemon(self): # Overridden in _MainThread and _DummyThread return current_thread().daemon def __repr__(self): assert self.__initialized, "Thread.__init__() was not called" status = "initial" if self.__started.is_set(): status = "started" if self.__stopped: status = "stopped" if self.__daemonic: status += " daemon" if self.__ident is not None: status += " %s" % self.__ident return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status) def start(self): if not self.__initialized: raise RuntimeError("thread.__init__() not called") if self.__started.is_set(): raise RuntimeError("thread already started") if __debug__: self._note("%s.start(): starting thread", self) _active_limbo_lock.acquire() _limbo[self] = self _active_limbo_lock.release() try: _start_new_thread(self.__bootstrap, ()) except Exception: with _active_limbo_lock: del _limbo[self] raise self.__started.wait() def run(self): try: if self.__target: self.__target(*self.__args, **self.__kwargs) finally: # Avoid a refcycle if the thread is running a function with # an argument that has a member that points to the thread. del self.__target, self.__args, self.__kwargs def __bootstrap(self): # Wrapper around the real bootstrap code that ignores # exceptions during interpreter cleanup. Those typically # happen when a daemon thread wakes up at an unfortunate # moment, finds the world around it destroyed, and raises some # random exception *** while trying to report the exception in # __bootstrap_inner() below ***. Those random exceptions # don't help anybody, and they confuse users, so we suppress # them. We suppress them only when it appears that the world # indeed has already been destroyed, so that exceptions in # __bootstrap_inner() during normal business hours are properly # reported. Also, we only suppress them for daemonic threads; # if a non-daemonic encounters this, something else is wrong. try: self.__bootstrap_inner() except: if self.__daemonic and _sys is None: return raise def _set_ident(self): self.__ident = _get_ident() def __bootstrap_inner(self): try: self._set_ident() self.__started.set() _active_limbo_lock.acquire() _active[self.__ident] = self del _limbo[self] _active_limbo_lock.release() if __debug__: self._note("%s.__bootstrap(): thread started", self) if _trace_hook: self._note("%s.__bootstrap(): registering trace hook", self) _sys.settrace(_trace_hook) if _profile_hook: self._note("%s.__bootstrap(): registering profile hook", self) _sys.setprofile(_profile_hook) try: self.run() except SystemExit: if __debug__: self._note("%s.__bootstrap(): raised SystemExit", self) except: if __debug__: self._note("%s.__bootstrap(): unhandled exception", self) # If sys.stderr is no more (most likely from interpreter # shutdown) use self.__stderr. Otherwise still use sys (as in # _sys) in case sys.stderr was redefined since the creation of # self. if _sys: _sys.stderr.write("Exception in thread %s:\n%s\n" % (self.name, _format_exc())) else: # Do the best job possible w/o a huge amt. of code to # approximate a traceback (code ideas from # Lib/traceback.py) exc_type, exc_value, exc_tb = self.__exc_info() try: print>>self.__stderr, ( "Exception in thread " + self.name + " (most likely raised during interpreter shutdown):") print>>self.__stderr, ( "Traceback (most recent call last):") while exc_tb: print>>self.__stderr, ( ' File "%s", line %s, in %s' % (exc_tb.tb_frame.f_code.co_filename, exc_tb.tb_lineno, exc_tb.tb_frame.f_code.co_name)) exc_tb = exc_tb.tb_next print>>self.__stderr, ("%s: %s" % (exc_type, exc_value)) # Make sure that exc_tb gets deleted since it is a memory # hog; deleting everything else is just for thoroughness finally: del exc_type, exc_value, exc_tb else: if __debug__: self._note("%s.__bootstrap(): normal return", self) finally: # Prevent a race in # test_threading.test_no_refcycle_through_target when # the exception keeps the target alive past when we # assert that it's dead. self.__exc_clear() finally: with _active_limbo_lock: self.__stop() try: # We don't call self.__delete() because it also # grabs _active_limbo_lock. del _active[_get_ident()] except: pass def __stop(self): self.__block.acquire() self.__stopped = True self.__block.notify_all() self.__block.release() def __delete(self): "Remove current thread from the dict of currently running threads." # Notes about running with dummy_thread: # # Must take care to not raise an exception if dummy_thread is being # used (and thus this module is being used as an instance of # dummy_threading). dummy_thread.get_ident() always returns -1 since # there is only one thread if dummy_thread is being used. Thus # len(_active) is always <= 1 here, and any Thread instance created # overwrites the (if any) thread currently registered in _active. # # An instance of _MainThread is always created by 'threading'. This # gets overwritten the instant an instance of Thread is created; both # threads return -1 from dummy_thread.get_ident() and thus have the # same key in the dict. So when the _MainThread instance created by # 'threading' tries to clean itself up when atexit calls this method # it gets a KeyError if another Thread instance was created. # # This all means that KeyError from trying to delete something from # _active if dummy_threading is being used is a red herring. But # since it isn't if dummy_threading is *not* being used then don't # hide the exception. try: with _active_limbo_lock: del _active[_get_ident()] # There must not be any python code between the previous line # and after the lock is released. Otherwise a tracing function # could try to acquire the lock again in the same thread, (in # current_thread()), and would block. except KeyError: if 'dummy_threading' not in _sys.modules: raise def join(self, timeout=None): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") if not self.__started.is_set(): raise RuntimeError("cannot join thread before it is started") if self is current_thread(): raise RuntimeError("cannot join current thread") if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__block.acquire() try: if timeout is None: while not self.__stopped: self.__block.wait() if __debug__: self._note("%s.join(): thread stopped", self) else: deadline = _time() + timeout while not self.__stopped: delay = deadline - _time() if delay <= 0: if __debug__: self._note("%s.join(): timed out", self) break self.__block.wait(delay) else: if __debug__: self._note("%s.join(): thread stopped", self) finally: self.__block.release() @property def name(self): assert self.__initialized, "Thread.__init__() not called" return self.__name @name.setter def name(self, name): assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) @property def ident(self): assert self.__initialized, "Thread.__init__() not called" return self.__ident def isAlive(self): assert self.__initialized, "Thread.__init__() not called" return self.__started.is_set() and not self.__stopped is_alive = isAlive @property def daemon(self): assert self.__initialized, "Thread.__init__() not called" return self.__daemonic @daemon.setter def daemon(self, daemonic): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") if self.__started.is_set(): raise RuntimeError("cannot set daemon status of active thread"); self.__daemonic = daemonic def isDaemon(self): return self.daemon def setDaemon(self, daemonic): self.daemon = daemonic def getName(self): return self.name def setName(self, name): self.name = name # The timer class was contributed by Itamar Shtull-Trauring def Timer(*args, **kwargs): return _Timer(*args, **kwargs) class _Timer(Thread): """Call a function after a specified number of seconds: t = Timer(30.0, f, args=[], kwargs={}) t.start() t.cancel() # stop the timer's action if it's still waiting """ def __init__(self, interval, function, args=[], kwargs={}): Thread.__init__(self) self.interval = interval self.function = function self.args = args self.kwargs = kwargs self.finished = Event() def cancel(self): """Stop the timer if it hasn't finished yet""" self.finished.set() def run(self): self.finished.wait(self.interval) if not self.finished.is_set(): self.function(*self.args, **self.kwargs) self.finished.set() # Special thread class to represent the main thread # This is garbage collected through an exit handler class _MainThread(Thread): def __init__(self): Thread.__init__(self, name="MainThread") self._Thread__started.set() self._set_ident() _active_limbo_lock.acquire() _active[_get_ident()] = self _active_limbo_lock.release() def _set_daemon(self): return False def _exitfunc(self): self._Thread__stop() t = _pickSomeNonDaemonThread() if t: if __debug__: self._note("%s: waiting for other threads", self) while t: t.join() t = _pickSomeNonDaemonThread() if __debug__: self._note("%s: exiting", self) self._Thread__delete() def _pickSomeNonDaemonThread(): for t in enumerate(): if not t.daemon and t.is_alive(): return t return None # Dummy thread class to represent threads not started here. # These aren't garbage collected when they die, nor can they be waited for. # If they invoke anything in threading.py that calls current_thread(), they # leave an entry in the _active dict forever after. # Their purpose is to return *something* from current_thread(). # They are marked as daemon threads so we won't wait for them # when we exit (conform previous semantics). class _DummyThread(Thread): def __init__(self): Thread.__init__(self, name=_newname("Dummy-%d")) # Thread.__block consumes an OS-level locking primitive, which # can never be used by a _DummyThread. Since a _DummyThread # instance is immortal, that's bad, so release this resource. del self._Thread__block self._Thread__started.set() self._set_ident() _active_limbo_lock.acquire() _active[_get_ident()] = self _active_limbo_lock.release() def _set_daemon(self): return True def join(self, timeout=None): assert False, "cannot join a dummy thread" # Global API functions def currentThread(): try: return _active[_get_ident()] except KeyError: ##print "current_thread(): no current thread for", _get_ident() return _DummyThread() current_thread = currentThread def activeCount(): _active_limbo_lock.acquire() count = len(_active) + len(_limbo) _active_limbo_lock.release() return count active_count = activeCount def _enumerate(): # Same as enumerate(), but without the lock. Internal use only. return _active.values() + _limbo.values() def enumerate(): _active_limbo_lock.acquire() active = _active.values() + _limbo.values() _active_limbo_lock.release() return active from thread import stack_size # Create the main thread object, # and make it available for the interpreter # (Py_Main) as threading._shutdown. _shutdown = _MainThread()._exitfunc # get thread-local implementation, either from the thread # module, or from the python fallback try: from thread import _local as local except ImportError: from _threading_local import local def _after_fork(): # This function is called by Python/ceval.c:PyEval_ReInitThreads which # is called from PyOS_AfterFork. Here we cleanup threading module state # that should not exist after a fork. # Reset _active_limbo_lock, in case we forked while the lock was held # by another (non-forked) thread. http://bugs.python.org/issue874900 global _active_limbo_lock _active_limbo_lock = _allocate_lock() # fork() only copied the current thread; clear references to others. new_active = {} current = current_thread() with _active_limbo_lock: for thread in _active.itervalues(): if thread is current: # There is only one active thread. We reset the ident to # its new value since it can have changed. ident = _get_ident() thread._Thread__ident = ident new_active[ident] = thread else: # All the others are already stopped. # We don't call _Thread__stop() because it tries to acquire # thread._Thread__block which could also have been held while # we forked. thread._Thread__stopped = True _limbo.clear() _active.clear() _active.update(new_active) assert len(_active) == 1 # Self-test code def _test(): class BoundedQueue(_Verbose): def __init__(self, limit): _Verbose.__init__(self) self.mon = RLock() self.rc = Condition(self.mon) self.wc = Condition(self.mon) self.limit = limit self.queue = deque() def put(self, item): self.mon.acquire() while len(self.queue) >= self.limit: self._note("put(%s): queue full", item) self.wc.wait() self.queue.append(item) self._note("put(%s): appended, length now %d", item, len(self.queue)) self.rc.notify() self.mon.release() def get(self): self.mon.acquire() while not self.queue: self._note("get(): queue empty") self.rc.wait() item = self.queue.popleft() self._note("get(): got %s, %d left", item, len(self.queue)) self.wc.notify() self.mon.release() return item class ProducerThread(Thread): def __init__(self, queue, quota): Thread.__init__(self, name="Producer") self.queue = queue self.quota = quota def run(self): from random import random counter = 0 while counter < self.quota: counter = counter + 1 self.queue.put("%s.%d" % (self.name, counter)) _sleep(random() * 0.00001) class ConsumerThread(Thread): def __init__(self, queue, count): Thread.__init__(self, name="Consumer") self.queue = queue self.count = count def run(self): while self.count > 0: item = self.queue.get() print item self.count = self.count - 1 NP = 3 QL = 4 NI = 5 Q = BoundedQueue(QL) P = [] for i in range(NP): t = ProducerThread(Q, NI) t.name = ("Producer-%d" % (i+1)) P.append(t) C = ConsumerThread(Q, NI*NP) for t in P: t.start() _sleep(0.000001) C.start() for t in P: t.join() C.join() if __name__ == '__main__': _test()