6 Nov
2008
6 Nov
'08
9:27 p.m.
Hi! Here are simple examples: 1. boost::mutex m; // non-thread safe commands { // non-thread safe commands boost::mutex::scoped_lock L (m); // thread safe commands } // on exiting scope the L is destroyed and so mutex _m_ is AUTO-unlocked. very convenient! // non-thread safe commands 2. boost::shared_mutex shm; can be locked with boost::unique_lockboost::shared_mutex ul (shm) or boost::shared_lockboost::shared_mutex ul (shm) so this implements single_writer/multiple_readers concept Hope this will help you to understand threads :)