Author: Armin Rigo <ar...@tunes.org> Branch: stm Changeset: r48690:65545adde075 Date: 2011-11-03 11:40 +0100 http://bitbucket.org/pypy/pypy/changeset/65545adde075/
Log: A poor man's lock: just use a regular counter and check it every second. As it's all protected by STM it works nicely. diff --git a/pypy/translator/stm/test/targetdemo.py b/pypy/translator/stm/test/targetdemo.py --- a/pypy/translator/stm/test/targetdemo.py +++ b/pypy/translator/stm/test/targetdemo.py @@ -30,6 +30,7 @@ add_at_end_of_chained_list(glob.anchor, i) rstm.transaction_boundary() print "thread done." + glob.done += 1 @@ -55,10 +56,12 @@ def entry_point(argv): invoke_around_extcall(before_external_call, after_external_call) print "hello world" + glob.done = 0 for i in range(NUM_THREADS): ll_thread.start_new_thread(run_me, ()) print "sleeping..." - time.sleep(10) + while glob.done < NUM_THREADS: # poor man's lock + time.sleep(1) print "done sleeping." return 0 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit