[Tutor] threading not working how about fork?
Ertl, John C CIV 63134
john.ertl at navy.mil
Wed Oct 22 23:44:55 CEST 2008
Classification: UNCLASSIFIED
Caveat (s): FOUO
Thanks for the help and I am looking into the pyprocessing but threading is causing too many headaches (I may have to rewrite things). Lets say I have something as simple as below:
def takeTime(a):
print "Started %s" % a
time.sleep(10)
print "Ended %s" % a
for each in [1,2,3,4,5]:
pid = os.fork()
takeTime(each)
Each time the function is called it waits 10 seconds. And if I run it as above it does the first and waits 10 seconds then the second and waits ten seconds...etc.
Wow could I get it to run through all 5 "forks" without waiting for the previous one to complete? That was all five would be done in about 10 seconds.
This is simpler than my real problem but I can not even figure this one out.
Thanks for the help.
John Ertl
Meteorologist
FNMOC
7 Grace Hopper Ave.
Monterey, CA 93943
(831) 656-5704
john.ertl at navy.mil
Classification: UNCLASSIFIED
Caveat (s): FOUO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081022/fbb2512a/attachment.htm>
More information about the Tutor
mailing list