rev 322 - trunk/pr
SVN User <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark Date: 2004-04-10 20:24:46 -0400 (Sat, 10 Apr 2004) New Revision: 322 Added: trunk/pr/threads.pr Log: REALLY added threads.pr this time Added: trunk/pr/threads.pr =================================================================== --- trunk/pr/threads.pr 2004-04-11 00:07:29 UTC (rev 321) +++ trunk/pr/threads.pr 2004-04-11 00:24:46 UTC (rev 322) @@ -0,0 +1,30 @@ +#!/usr/bin/env prothon + +# threads.pr + +Finished_thread_count = 0 + +def func(n, d): + my_thread = Current_thread() + print my_thread, "started" + for i in n: + Sleep(d) + print my_thread, "has been running",(i+1)*d,'seconds' + Finished_thread_count += 1 + +a = Thread(func, [10, 1.0000], "A") +b = Thread(func, [ 5, 2.0000], "B") +c = Thread(func, [ 3, 3.3333], "C") + +/* +these cause an apr_error ??? +a.join() +b.join() +c.join() +*/ + +while Finished_thread_count < 3: + Sleep(0.1) +print +print 'All threads finished' +print