Liming Zhao
unread,May 11, 2012, 1:16:16 PM5/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gevent: coroutine-based Python network library
using gevent/1.0b2, greenlet/0.3.4
import os
from gevent.hub import fork, get_hub
print 'parent_pid=%d, hub=%s' % (os.getpid(), get_hub())
pid = fork()
if not pid:
# child
print 'child_pid=%d, hub=%s' % (os.getpid(), get_hub())
os._exit(0)
print 'parent_pid=%d, hub=%s' % (os.getpid(), get_hub())
PRINTS:
parent_pid=19326, hub=<Hub at 0x19d92eb0 epoll default pending=0 ref=0
fileno=3>
child_pid=19327, hub=<Hub at 0x19d92eb0 epoll default pending=0 ref=0
fileno=3>
parent_pid=19326, hub=<Hub at 0x19d92eb0 epoll default pending=0 ref=0
fileno=3>
If hub is said to be thread local, should subprocess have its own hub
or not?
Thanks!