ž
¬ÿf¡ c @ 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
Gd d „ d e ƒ Z d a d a d d „ Z d S( 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
u erroru start_new_threadu exitu get_identu
allocate_locku interrupt_mainu LockTypei i 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( uæ 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.
u 2nd arg must be a tupleu 3rd arg must be a dicti NFT( u typeu tupleu TypeErroru dictu Falseu _mainu
SystemExitu tracebacku print_excu Trueu
_interruptu KeyboardInterrupt( u functionu argsu kwargsu traceback( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu start_new_thread s
c C s
t ‚ d S( u' Dummy implementation of _thread.exit().N( u
SystemExit( ( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu exit= s c C s d S( uô 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.
i iÿÿÿÿ( ( ( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu get_identA s c C s t ƒ S( u0 Dummy implementation of _thread.allocate_lock().( u LockType( ( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu
allocate_lockJ s c C s | d k r t d ƒ ‚ n d S( u- Dummy implementation of _thread.stack_size().u' setting thread stack size not supportedi N( u Noneu error( u size( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu
stack_sizeN s u
stack_sizec B sb | Ee 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( u LockTypeu� 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( u Falseu
locked_status( u self( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu __init___ s u LockType.__init__i 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( u© 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.
i NTF( u Noneu Trueu
locked_statusu timeu sleepu False( u selfu waitflagu timeoutu time( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu acquireb s u LockType.acquirec C s | j ƒ d S( N( u release( u selfu typu valu tb( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu __exit__| s u LockType.__exit__c C s | j s t ‚ n d | _ d S( u Release the dummy lock.FT( u
locked_statusu erroru Falseu True( u self( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu release s u LockType.releasec C s | j S( N( u
locked_status( u self( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu lockedˆ s u LockType.lockedNiÿÿÿÿ( u __name__u
__module__u __qualname__u __doc__u __init__u Noneu acquireu __enter__u __exit__u releaseu locked( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu LockTypeT s c C s t r t ‚ n d a d S( u^ Set _interrupt flag to True to have start_new_thread raise
KeyboardInterrupt upon exiting.NT( u _mainu KeyboardInterruptu Trueu
_interrupt( ( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu interrupt_main� s Nl FT( u __doc__u __all__u TIMEOUT_MAXu RuntimeErroru erroru start_new_threadu exitu get_identu
allocate_locku Noneu
stack_sizeu objectu LockTypeu Falseu
_interruptu Trueu _mainu interrupt_main( ( ( u2 /opt/alt/python33/lib64/python3.3/_dummy_thread.pyu