AlkantarClanX12
Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/ |
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/_dummy_thread.cpython-34.pyo |
� i f � @ s� d Z d d d d d d d g Z d Z e Z i d d � Z d d � Z d d � Z d d � Z d d d � Z d d � Z Gd d � d e � Z d a d a d d � Z d S)a/ 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 �error�start_new_thread�exit� get_ident� allocate_lock�interrupt_main�LockType� � c C s� t | � t t � � k r* t d � � n t | � t t � � k rT t d � � n d a y | | | � Wn/ t k r Yn d d l } | j � Yn Xd a t r� d a t � n d S)a� Dummy 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. z2nd arg must be a tuplez3rd arg must be a dictF� NT) �type�tuple� TypeError�dict�_main� SystemExit� traceback� print_exc� _interrupt�KeyboardInterrupt)Zfunction�args�kwargsr � r �2/opt/alt/python34/lib64/python3.4/_dummy_thread.pyr s c C s t � d S)z'Dummy implementation of _thread.exit().N)r r r r r r = s c C s d S)z�Dummy 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. � ���r r r r r r A s c C s t � S)z0Dummy implementation of _thread.allocate_lock().)r r r r r r J s Nc C s | d k r t d � � n d S)z-Dummy implementation of _thread.stack_size().Nz'setting thread stack size not supportedr )r )�sizer r r � stack_sizeN s r c C s t � S)z0Dummy implementation of _thread._set_sentinel().)r r r r r � _set_sentinelT s r c @ s^ e Z d Z d Z d d � Z d d d d � Z e Z d d � Z d d � Z d d � Z d S)r a� Class 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. c C s d | _ d S)NF)� locked_status)�selfr r r �__init__c s zLockType.__init__Nr c C se | d k s | r d | _ d S| j s5 d | _ d S| d k r] d d l } | j | � n d Sd S)a� Dummy 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. NTr F)r �timeZsleep)r ZwaitflagZtimeoutr! r r r �acquiref s zLockType.acquirec C s | j � d S)N)�release)r �typ�val�tbr r r �__exit__� s zLockType.__exit__c C s | j s t � n d | _ d S)zRelease the dummy lock.FT)r r )r r r r r# � s zLockType.releasec C s | j S)N)r )r r r r �locked� s zLockType.lockedr ) �__name__� __module__�__qualname__�__doc__r r"