fc@sdZdddddddgZdZeZid dZd dZd dZd dZdddZ Gddde Z dadaddZdS(u/Drop-in replacement for the thread module. Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: try: import _thread except ImportError: import _dummy_thread as _thread uerrorustart_new_threaduexitu get_identu allocate_lockuinterrupt_mainuLockTypeiic Cst|ttkr*tdnt|ttkrTtdnday|||Wn/tk rYnddl}|jYnXdat rda t ndS(uDummy implementation of _thread.start_new_thread(). Compatibility is maintained by making sure that ``args`` is a tuple and ``kwargs`` is a dictionary. If an exception is raised and it is SystemExit (which can be done by _thread.exit()) it is caught and nothing is done; all other exceptions are printed out by using traceback.print_exc(). If the executed function calls interrupt_main the KeyboardInterrupt will be raised when the function returns. u2nd arg must be a tupleu3rd arg must be a dictiNFT( utypeutupleu TypeErrorudictuFalseu_mainu SystemExitu tracebacku print_excuTrueu _interruptuKeyboardInterrupt(ufunctionuargsukwargsu traceback((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyustart_new_threads   cCs tdS(u'Dummy implementation of _thread.exit().N(u SystemExit(((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyuexit=scCsdS(uDummy implementation of _thread.get_ident(). Since this module should only be used when _threadmodule is not available, it is safe to assume that the current process is the only thread. Thus a constant can be safely returned. ii((((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyu get_identAscCstS(u0Dummy implementation of _thread.allocate_lock().(uLockType(((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyu allocate_lockJscCs|dk rtdndS(u-Dummy implementation of _thread.stack_size().u'setting thread stack size not supportediN(uNoneuerror(usize((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyu stack_sizeNs u stack_sizecBsb|EeZdZdZddZd dddZeZddZd d Z d d Z d S(uLockTypeuClass implementing dummy implementation of _thread.LockType. Compatibility is maintained by maintaining self.locked_status which is a boolean that stores the state of the lock. Pickling of the lock, though, should not be done since if the _thread module is then used with an unpickled ``lock()`` from here problems could occur from this class not having atomic methods. cCs d|_dS(NF(uFalseu locked_status(uself((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyu__init___suLockType.__init__icCse|dks|rd|_dS|js5d|_dS|dkr]ddl}|j|ndSdS(uDummy implementation of acquire(). For blocking calls, self.locked_status is automatically set to True and returned appropriately based on value of ``waitflag``. If it is non-blocking, then the value is actually checked and not set if it is already acquired. This is all done so that threading.Condition's assert statements aren't triggered and throw a little fit. iNTF(uNoneuTrueu locked_statusutimeusleepuFalse(uselfuwaitflagutimeoututime((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyuacquirebs      uLockType.acquirecCs|jdS(N(urelease(uselfutypuvalutb((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyu__exit__|suLockType.__exit__cCs|jstnd|_dS(uRelease the dummy lock.FT(u locked_statusuerroruFalseuTrue(uself((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyureleases   uLockType.releasecCs|jS(N(u locked_status(uself((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyulockedsuLockType.lockedNi( u__name__u __module__u __qualname__u__doc__u__init__uNoneuacquireu __enter__u__exit__ureleaseulocked(u __locals__((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyuLockTypeTs    cCstrtndadS(u^Set _interrupt flag to True to have start_new_thread raise KeyboardInterrupt upon exiting.NT(u_mainuKeyboardInterruptuTrueu _interrupt(((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyuinterrupt_mains NlFT(u__doc__u__all__u TIMEOUT_MAXu RuntimeErroruerrorustart_new_threaduexitu get_identu allocate_lockuNoneu stack_sizeuobjectuLockTypeuFalseu _interruptuTrueu_mainuinterrupt_main(((u2/opt/alt/python33/lib64/python3.3/_dummy_thread.pyu s   8