> I've got better advice <wink>: Never use semaphores for anything. Never > use locks except for dirt-simple one- or two-line critical sections. For > everything but the latter, always use condition variables. They're the only > synch protocol I've seen that non-specialist thread programmers can use > without routinely screwing themselves. The genius of the condvar protocol > is that, used correctly, you *always* run-time test your crucial assumptions > about non-local state (and automatically do so under the protection of a > critical section), and *always* loop back to try again if your hopes or > assumptions turn out not to be true. This saves you from a universe of > possible problems with non-local state changing in unanticipated ways. I believe that Aahz, in his thread tutorial, has even more radical advice: use the Queue module for all inter-thread communication. It is even higher level than semaphores, and has the same nice properties. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4