<s> from __future__ import print_function <EOL> import gevent . monkey ; gevent . monkey . patch_all ( ) <EOL> import gevent <EOL> import os <EOL> import multiprocessing <EOL> hub = gevent . get_hub ( ) <EOL> pid = os . getpid ( ) <EOL> newpid = None <EOL> def on_fork ( ) : <EOL> global newpid <EOL> newpid = os . getpid ( ) <EOL> fork_watcher = hub . loop . fork ( ref = False ) <EOL> fork_watcher . start ( on_fork ) <EOL> def run ( q ) : <EOL> gevent . sleep ( <NUM_LIT> ) <EOL> gevent . sleep ( <NUM_LIT> ) <EOL> q . put ( newpid ) <EOL> def test ( ) : <EOL> hub . threadpool . apply ( lambda : None ) <EOL> q = multiprocessing . Queue ( ) <EOL> p = multiprocessing . Process ( target = run , args = ( q , ) ) <EOL> p . start ( ) <EOL> p . join ( ) <EOL> p_val = q . get ( ) <EOL> assert p_val is not None , "<STR_LIT>" <EOL> assert p_val != pid <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> multiprocessing . freeze_support ( ) <EOL> test ( ) </s>
