Make a small function thread safe
Brad Tilley
kj4eit at gmail.com
Fri Dec 16 08:21:50 EST 2011
Hey guys,
I have a C++ function that I'd like to replicate (as closely as
possible) in Python. Here's an example:
107 void increment_counter( unsigned int& counter )
108 {
109 boost::mutex::scoped_lock lock( counter_lock );
110 ++counter;
111 }
A thread locks the function on entrance and then releases it on exit.
What is the equivalent way to do this in Python?
Many thanks!
Brad
More information about the Python-list
mailing list