def currentThread():
try:
return _active[_get_ident()]
except KeyError:
##print "current_thread(): no current thread for", _get_ident()
return _DummyThread()
def calc(self, n, level ):
if level == 0:
print threading.currentThread(), "start"
now = time.time()
self._value = self.sequential(n)
print "sequential(%d)" % n, time.time() - now
else:
src/d/i/dionea-HEAD/dionea/trunk/sample/python/testRWLock.py dionea(Download)
def reader_run(self):
thid = thread.get_ident()
self.rand = random.Random()
thobj = threading.currentThread()
while True:
var = self.var.read()
print "[%s %d] readed value- %d" % (thobj.getName(), thid, var)
time.sleep(self.rand.randint(1, 9))
def writer_run(self):
thid = thread.get_ident()
self.rand = random.Random()
thobj = threading.currentThread()
src/b/r/braintree_python_examples-HEAD/tr_checkout_app_engine/web/wsgiserver/__init__.py braintree_python_examples(Download)
self._queue.put(_SHUTDOWNREQUEST)
# Don't join currentThread (when stop is called inside a request).
current = threading.currentThread()
while self._threads:
worker = self._threads.pop()
if worker is not current and worker.isAlive():
src/b/r/braintree_python_examples-HEAD/tr_checkout_app_engine/web/utils.py braintree_python_examples(Download)
def _getd(self):
t = threading.currentThread()
if not hasattr(t, '_d'):
# using __dict__ of thread as thread local storage
t._d = {}
# there could be multiple instances of ThreadedDict.
src/d/r/dramatis-0.1.1/examples/fib/conservative.py dramatis(Download)
def calc(self, n, level ):
if level == 0:
print threading.currentThread(), "start"
now = time.time()
self._value = self.sequential(n)
print "sequential(%d)" % n, time.time() - now
else:
src/b/r/braintree_python_examples-HEAD/tr_checkout_app_engine/web/application.py braintree_python_examples(Download)
# clearing the thread-local storage to avoid that.
# see utils.ThreadedDict for details
import threading
t = threading.currentThread()
if hasattr(t, '_d'):
del t._d
src/s/p/spike-HEAD/vendor/stackless/v2.5.1/Stackless/demo/stephan/stacklessness/stacklessness.py spike(Download)
from threading import Event, currentThread, Lock, Thread import time import sys import logging from atexit import register __all__ = 'run getcurrent getmain tasklet channel schedule'.split()
mt = tasklet(None)
mt._active = True
mt._name = 'MainTask'
maintask = currentThread()
log.info(str(maintask))
maintask.event = Event()
mt.thread = maintask
def getcurrent():
ct = currentThread()
return ct.tasklet
def getmain():
return maintasklet
def schedule(self):
log.info('%s Scheduler.schedule()' % getcurrent())
log.info('\ttasklist:%s' % self)
ct = currentThread()
ctask = ct.tasklet
log.info('\tcurrent tasklet is: %s' % ctask)
nt = self.next()
src/s/p/spike-HEAD/vendor/stackless/current/Stackless/demo/stephan/stacklessness/stacklessness.py spike(Download)
from threading import Event, currentThread, Lock, Thread import time import sys import logging from atexit import register __all__ = 'run getcurrent getmain tasklet channel schedule'.split()
mt = tasklet(None)
mt._active = True
mt._name = 'MainTask'
maintask = currentThread()
log.info(str(maintask))
maintask.event = Event()
mt.thread = maintask
def getcurrent():
ct = currentThread()
return ct.tasklet
def getmain():
return maintasklet
def schedule(self):
log.info('%s Scheduler.schedule()' % getcurrent())
log.info('\ttasklist:%s' % self)
ct = currentThread()
ctask = ct.tasklet
log.info('\tcurrent tasklet is: %s' % ctask)
nt = self.next()
src/s/t/stackless-HEAD/Stackless/demo/stephan/stacklessness/stacklessness.py stackless(Download)
from threading import Event, currentThread, Lock, Thread import time import sys import logging from atexit import register __all__ = 'run getcurrent getmain tasklet channel schedule'.split()
mt = tasklet(None)
mt._active = True
mt._name = 'MainTask'
maintask = currentThread()
log.info(str(maintask))
maintask.event = Event()
mt.thread = maintask
def getcurrent():
ct = currentThread()
return ct.tasklet
def getmain():
return maintasklet
def schedule(self):
log.info('%s Scheduler.schedule()' % getcurrent())
log.info('\ttasklist:%s' % self)
ct = currentThread()
ctask = ct.tasklet
log.info('\tcurrent tasklet is: %s' % ctask)
nt = self.next()
src/j/y/jython-HEAD/sandbox/tobias/jython/CPythonLib/idlelib/rpc.py jython(Download)
def __init__(self, sock, objtable=None, debugging=None):
self.sockthread = threading.currentThread()
if debugging is not None:
self.debugging = debugging
self.sock = sock
if objtable is None:
objtable = objecttable
def asynccall(self, oid, methodname, args, kwargs):
request = ("CALL", (oid, methodname, args, kwargs))
seq = self.newseq()
if threading.currentThread() != self.sockthread:
cvar = threading.Condition()
self.cvars[seq] = cvar
self.debug(("asynccall:%d:" % seq), oid, methodname, args, kwargs)
self.putmessage((seq, request))
return seq
def asyncqueue(self, oid, methodname, args, kwargs):
request = ("QUEUE", (oid, methodname, args, kwargs))
seq = self.newseq()
if threading.currentThread() != self.sockthread:
def _getresponse(self, myseq, wait):
self.debug("_getresponse:myseq:", myseq)
if threading.currentThread() is self.sockthread:
# this thread does all reading of requests or responses
while 1:
response = self.pollresponse(myseq, wait)
if response is not None:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next