Esempio n. 1
0
def fork_main(child_no=1):
	print 'parent:', os.getpid()

	def create_shared():
		return {'name': 'realtime'}

	channels = create_shared()
	posh.share(channels)

	evwsgi.start('0.0.0.0', '8080')
	evwsgi.set_base_module(base)

	child = list()
	for i in range(child_no):
		child.append(posh.forkcall(start, i, channels))

	def on_interrupt(signum, frame):
		print 'terminating %i children' % len(child)
		for pid in child:
			print 'kill(%i)' % pid
			os.kill(pid, signal.SIGINT)
	signal.signal(signal.SIGINT, on_interrupt)

	print 'forked %i childs' % len(child)
	posh.waitall()
Esempio n. 2
0
 def setup(self, nv):
     import posh
     self.nv = nv.copy()
     self.snv = posh.share(self.nv)
Esempio n. 3
0
 def setup( self, nv ):
     import posh
     self.nv = nv.copy()
     self.snv = posh.share(self.nv)