%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/fork_wait.pyo

ó
Nêáac@sƒdZddlZddlZddlZddlZddljZejdƒZdZ	dZ
dZdejfd„ƒYZ
dS(	sûThis test case provides support for checking forking and wait behavior.

To test different wait behavior, override the wait_impl method.

We want fork1() semantics -- only the forking thread survives in the
child after a fork().

On some systems (e.g. Solaris without posix threads) we find that all
active threads survive in the child after a fork(); this is an error.

While BeOS doesn't officially support fork and native threading in
the same application, the present example should work just fine.  DC
iÿÿÿÿNt	threadingigà?itForkWaitcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs.tjƒ|_i|_d|_g|_dS(Ni(tsupporttthreading_setupt_threading_keytalivetstoptthreads(tself((s*/usr/local/lib/python2.7/test/fork_wait.pytsetUps		cCsHd|_x|jD]}|jƒqWd}|j2tj|jŒdS(Ni(RRtjointNoneRtthreading_cleanupR(Rtthread((s*/usr/local/lib/python2.7/test/fork_wait.pyttearDown s	cCsLxE|jsGtjƒ|j|<ytjtƒWqtk
rCqXqWdS(N(RtostgetpidRttimetsleept
SHORTSLEEPtIOError(Rtid((s*/usr/local/lib/python2.7/test/fork_wait.pytf)s
cCsŒxPtdƒD]B}tj|tjƒ\}}||kr>Pntjdtƒq
W|j||ƒ|j|dd|d@|d?fƒdS(Ni
iiscause = %d, exit = %diÿi(trangeRtwaitpidtWNOHANGRRRtassertEqual(Rtcpidtitspidtstatus((s*/usr/local/lib/python2.7/test/fork_wait.pyt	wait_impl1scCs<xLttƒD]>}tjd|jd|fƒ}|jƒ|jj|ƒq
Wtj	t
ƒ|jjƒ}|j
ƒ|j|ttƒƒ|jjƒ}tjdkr¸tjƒ}ntjƒ}|dkr+tj	t
ƒd}x5|jD]*}|j|||krí|d7}qíqíWtj|ƒn
|j|ƒdS(Nttargettargst	unixware7ii(R"(RtNUM_THREADSRtThreadRtstartRtappendRRt	LONGSLEEPRtkeystsortRtcopytsystplatformRtfork1tforkt_exitR(RRR
tat
prefork_livesRtntkey((s*/usr/local/lib/python2.7/test/fork_wait.pyt	test_wait=s(



(t__name__t
__module__R	RRRR4(((s*/usr/local/lib/python2.7/test/fork_wait.pyRs
					(t__doc__RR+Rtunittestttest.supportRt
import_moduleRR'RR#tTestCaseR(((s*/usr/local/lib/python2.7/test/fork_wait.pyt<module>
s0

Zerion Mini Shell 1.0