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/p/y/PyZ3950-HEAD/example/twisted/test.py PyZ3950(Download)
from PyZ3950 import zoom from threading import Thread, currentThread from Queue import Queue thread_count = 10
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()
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next