[Python-ideas] [Value Returning Threard]
yoav glazner
yoavglazner at gmail.com
Thu May 7 08:10:40 CEST 2009
>
>
> >Please provide more explanation for why the currently available features
> >are insufficient. Note that what you're asking for would change the
> >semantics of Python at a very deep level and will almost certainly be
> >rejected in its present form.
> --
> >Aahz (aahz at pythoncraft.com) <*>
> http://www.pythoncraft.com/
>
I'm no python expert but i had to do a stress test on a libary. (checking
thread safety)
here is the code (we soe absraction):
def testMultiThread():
global resultDict
resultDict = {}
def testFuncThread(func):
global resultDict
if func():
resultDict[func] = 'Passed'
else:
resultDict[func] = 'Falied'
thread.start_new(testFuncThread,(Test1,))
thread.start_new(testFuncThread,(Test2,))
thread.start_new(testFuncThread,(Test3,))
while (len(resultDict) < 3):
time.sleep(5)
return resultDict #here i did something else such as logging and
returning True or False
Maybe there is a better way for doing this?
If we had something like i suggested (with .value or not)
def testMultiThread():
resultDict = {}
resultDict[Test1]= thread.startValueReturningThread(Test1)
resultDict[Test1]= thread.startValueReturningThread(Test2)
resultDict[Test1]= thread.startValueReturningThread(Test3)
return resultDict #or again, pharsing the result...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090507/0fa0d644/attachment.html>
More information about the Python-ideas
mailing list