Ovidiu Ciule wrote:
The util/Logger.h header contains this declaration: mutable boost::mutex
_mutex;
and the .cpp:
void Logger::log(Level level, const std::string & className, const
std::string & message) {
boost::mutex::scoped_lock scopedLock(_mutex);
...
What purpose does this lock serve? I understand mutex mechanisms,
semaphores etc.
What I cannot see here is the shared ressource that is protected by
this lock, nor what makes this lock necessary.
Read the documentation from boost about scoped mutex.
A scoped mutex ensures that the 'scoped' code will be executed by one
and only one thread at a time. It's here to get a thread-safe logger
system: multiple threads can use this class.
If you check the svn log you will see that it was added later on
--
Tanguy Krotoff <[EMAIL PROTECTED]>
http://openwengo.org
_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel