ó V Qc@s^ddlZddlZdefd„ƒYZddd„ƒYZd„Zd„ZeƒdS( iÿÿÿÿNtKilledcBseZRS((t__name__t __module__(((s./usr/lib64/python2.7/Demo/threads/Generator.pyRst GeneratorcBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsstjƒ|_tjƒ|_|jjƒ|jjƒ||_||_d|_d|_tj |j dƒdS(Ni(( tthreadt allocate_locktgetlocktputlocktacquiretfunctargstdonetkilledtstart_new_threadt_start(tselfR R ((s./usr/lib64/python2.7/Demo/threads/Generator.pyt__init__ s      cCsyzO|jjƒ|jsNyt|j|f|jƒWqNtk rJqNXnWd|jstd|_|jj ƒnXdS(Ni( RRR tapplyR R RR Rtrelease(R((s./usr/lib64/python2.7/Demo/threads/Generator.pyRs      cCsN|jrtd‚n||_|jjƒ|jjƒ|jrJt‚ndS(Ns put() called on killed generator(R t TypeErrortvalueRRRRR(RR((s./usr/lib64/python2.7/Demo/threads/Generator.pytput%s      cCsH|jrtd‚n|jjƒ|jjƒ|jrAt‚n|jS(Ns get() called on killed generator( R RRRRRR tEOFErrorR(R((s./usr/lib64/python2.7/Demo/threads/Generator.pytget/s      cCs/|jrtd‚nd|_|jjƒdS(Ns!kill() called on killed generatori(R RRR(R((s./usr/lib64/python2.7/Demo/threads/Generator.pytkill9s   cCst|j|jƒS(N(RR R (R((s./usr/lib64/python2.7/Demo/threads/Generator.pytclone@s(RRRRRRRR(((s./usr/lib64/python2.7/Demo/threads/Generator.pyR s   c Csæd\}}}}}xÊ||d|d|d}}}||||||||||f\}}}}||||}} xU|| krÞ|jt|ƒƒd||d||}}||||}} qŠWqdS(Nllll l (llll l(Rtint( tgtktatbta1tb1tptqtdtd1((s./usr/lib64/python2.7/Demo/threads/Generator.pytpiCs$6cCsttdƒ}|jƒttdƒ}xtdƒD]}|jƒGq5WH|jƒ}|jƒx|jƒGtjjƒqcdS(Ni ((( RR%RtrangeRRtsyststdouttflush(Rtith((s./usr/lib64/python2.7/Demo/threads/Generator.pyttestPs    ((R'Rt ExceptionRRR%R,(((s./usr/lib64/python2.7/Demo/threads/Generator.pyts  :