All Samples(40) | Call(38) | Derive(0) | Import(2)
get_ident() -> integer Return a non-zero integer that uniquely identifies the current thread amongst other threads that exist simultaneously. This may be used to identify per-thread resources. Even though on some platforms threads identities may appear to be allocated consecutive numbers starting at 1, this behavior should not be relied upon, and the number should be seen purely as a magic cookie. A thread's identity may be reused for another thread after it exits.
src/t/h/threading2-0.1.4/threading2/t2_base.py threading2(Download)
import threading2
from threading import *
from threading import _RLock,_Event,_Condition,_Semaphore,_BoundedSemaphore, \
_Timer,ThreadError,_time,_sleep,_get_ident,_allocate_lock
def acquire(self,blocking=True,timeout=None):
me = _get_ident()
if self.__owner == me:
self.__count += 1
return True
if self.__block.acquire(blocking,timeout):
self.__owner = me
self.__count = 1
return True
return False
def release(self):
if self.__owner != _get_ident():
def _is_owned(self):
return self.__owner == _get_ident()
class Condition(_Condition):
"""Re-implemented Condition class.
def before_run(self):
self.__ident = _get_ident()
if self.__priority is not None:
self._set_priority(self.__priority)
@property
def ident(self):
return self.__ident
src/s/k/skink-HEAD/skink/lib/cherrypy/process/plugins.py skink(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/f/o/Forban-HEAD/lib/ext/cherrypy/process/plugins.py Forban(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/b/e/benchit-HEAD/trunk/lib/cherrypy/process/plugins.py benchit(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/p/r/productiontrack-HEAD/pt1/tools/cherrypy/process/plugins.py productiontrack(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/p/y/pypy-HEAD/pypy/lib/sqlite3/dbapi2.py pypy(Download)
import sys import time import weakref from threading import _get_ident as thread_get_ident apilevel = "2.0" paramstyle = "qmark"
self.NotSupportedError = NotSupportedError
self.func_cache = {}
self.thread_ident = thread_get_ident()
def _get_exception(self, error_code = None):
if error_code is None:
def _check_thread(self):
if self.thread_ident != thread_get_ident():
raise ProgrammingError(
"SQLite objects created in a thread can only be used in that same thread."
"The object was created in thread id %d and this is thread id %d",
self.thread_ident, thread_get_ident())
src/b/e/benchit-HEAD/lib/cherrypy/process/plugins.py benchit(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/p/r/productiontrack-HEAD/tools/cherrypy/process/plugins.py productiontrack(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/g/u/guish-HEAD/web/cherrypy/process/plugins.py guish(Download)
def acquire_thread(self):
"""Run 'start_thread' listeners for the current thread.
If the current thread has already been seen, any 'start_thread'
listeners will not be run again.
"""
thread_ident = threading._get_ident()
def release_thread(self):
"""Release the current thread and run 'stop_thread' listeners."""
thread_ident = threading._get_ident()
i = self.threads.pop(thread_ident, None)
if i is not None:
self.bus.publish('stop_thread', i)
src/p/y/pyspider-HEAD/spider/trunk/spider/model.py pyspider(Download)
def getConnection(self):
global hub
tid=threading._get_ident()
try:
con=self.connections[tid]
except KeyError:
print 'key error re-connecting'
def getLock(self):
while not self._checklock():
#print 'in check lock'
time.sleep(0.02)
self.lockingthread=threading._get_ident()
getLock=synch(getLock)
def relLock(self):
self.lockingthread=None
def _checklock(self):
if self.lockingthread == threading._get_ident() or self.lockingthread is None:
def kill(self):
tid=threading._get_ident()
dellist=[]
self.connections[tid].close()
#del self.lastaccess[tid]
dellist.append(tid)
for l in dellist:
1 | 2 Next