def isInThreadPool():
 threadpool = reactor.getThreadPool()
 return ((threadpool is not None) and (current_thread() in threadpool.threads))

def isInThreadPool ( ) : threadpool = reactor . getThreadPool ( ) return ( ( threadpool is not None ) and ( current_thread ( ) in threadpool . threads ) )
check if we are currently on one of twisted threadpool threads .