Ϫf dZddlmZGddZdZde_dZdZd Zd Z dd Z e Z d Z d ZdZdadadada ddlZeZe dgdZy#e$rdZYwxYw)zT A module to provide some very basic threading primitives, such as synchronization. wrapsceZdZdZdZy) DummyLockzF Hack to allow locks to be unpickled on an unthreaded system. ctdfSN unpickle_lockselfs ;/usr/lib/python3/dist-packages/twisted/python/threadable.py __reduce__zDummyLock.__reduce__s r""N)__name__ __module__ __qualname____doc__rr rrrrs #rrc6t tStSN)threadingmoduleXLockrr rrr r s"w{rTcd|jvrMtjd|jvrt|jd<tj |j jy)N_threadable_lock)__dict___synchLockCreatoracquirerreleaserr s r _synchPrer!sU.!!# T]] 205DMM, -!!#!!#rc8|jjyr)rrr s r _synchPostr!*s!!#rc.tfd}|S)Ncjt| |g|i|t|S#t|wxYwr)rr!)r argskwargsfunctions rsyncz_sync..sync/s2$ D24262 t Jt s % 2r)klassr&r's ` r_syncr).s  8_ Krct?|D]9}|jD](}t||j|}t |||*;yy)a& Make all methods listed in each class' synchronized attribute synchronized. The synchronized attribute should be a list of strings, consisting of the names of methods that must be synchronized. If we are running in threaded mode these methods will be wrapped with a lock. N)r synchronizedr)rsetattr)klassesr( methodNamer's r synchronizer/:sT" 1E#00 1 UENN:$>?z40 1 1#rc|r>ts7t&daGddtjatayt dytr t dy)zbInitialize threading. Don't bother calling this. If it needs to happen, it will happen. NTceZdZdZy)rctdfSrr r s rrzXLock.__reduce__Vs -r22rN)rrrrr rrrrUs3rrz:Cannot initialize threading, platform lacks thread supportzCannot uninitialize threads)threadedr_RLockrr RuntimeError) with_threadss rinitr7IsZ*3O223%*G!"P <= = rcVttStjjSr)r_dummyIDcurrent_threadidentr rr getThreadIDr<hs"  ) ) + 1 11rc$ttk(S)zCAre we in the thread responsible for I/O requests (the event loop)?)ioThreadr<r rr isInIOThreadr?ns {} $$rctay)z8Mark the current thread as responsible for I/O requests.N)r<r>r rrregisterAsIOThreadrAss }HrNF)r?rAr<r))r functoolsrrr __safe_for_unpickling__rr!r)r/r7objectr9r<r?rAr>r3rr threading_threadingmoduler ImportError__all__r rrrJs  ##)- %$$  18 82 %    ('OJ IOsAA#"A#