Josh Close wrote:

>I'm having a problem in python doing a fork, getting data, then
>returning it. I'm using a pipe to send the data back, but if a couple
>processes send the data at the same time, then more than one set of
>data will be returned at the same time.
>
>Is there a way of getting them returned in one at a time? I could
>always use a temp file, but I'd rather not. I have to use fork also
>because I'm using some functins that aren't thread safe.
>
>###### code ######
>
>import os, time
>
>pipeRead, pipeWrite = os.pipe()
>
>processes = 0
>for i in xrange(10):
>    pid = os.fork()
>    processes += 1
>    if pid == 0:
>        os.write(pipeWrite, "write something here")
>        os._exit(0)
>
>print os.read(pipeRead, 1024)
>
># wait for all children to finish
>for i in xrange(processes):
>    os.wait()
>
>print "all children done"
>
>###### code ######
>
>  
>
I would consider using sockets rather than pipes. 

Tom Veldhouse

--
gentoo-user at gentoo.org mailing list



_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
Help beta test TCLUG's potential new home: http://plone.mn-linux.org
Got pictures for TCLUG? Beta test http://plone.mn-linux.org/gallery
tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list