Jeffrey Yasskin <jyass...@gmail.com> added the comment:

You should probably mention that pthread_barrier and 
java.util.concurrent.CyclicBarrier are prior art for this. I'm thinking about 
them when looking at the API to see whether your differences make sense.

"enter" seems to be the wrong term for this, since there's no matching "exit" 
call. "wait" or "block" seem better.

Both pthread_barrier and CyclicBarrier provide a way to identify a unique 
thread from each group. pthread_barrier_wait returns true in exactly one 
thread, while CyclicBarrier runs a callback while all other threads are still 
paused. I'd be inclined to use CyclicBarrier's interface here, although then 
you have to define what happens when the action raises an exception.

_release should notify_all after its loop.

adjust_count makes me nervous. Is there a context manager interface that would 
make this cleaner/safer?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8777>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to