Subj : Re: Study Material for Multi-threaded application developement in To : comp.programming.threads From : Torsten Robitzki Date : Thu May 26 2005 07:55 pm partow@gmail.com wrote: > Hi Santosh, > > Try this C++ library, I will give you directions > on how to create and use threads in a c++ context. > > http://www.partow.net/programming/posixsynchwrapper/index.html As you advertise you wrapper here, I might give some comments: - In my opinion the wrappers lake a consistent error handling. A POSIXMutex can be created with different error reporting, the ReadWriteMutex can not. Destructors will throw exceptions instead of asserting (pthread_mutex_destroy() can not fail if there is not bug involved). I would report all errors that are not bugs, by throwing an exception because it's quit unlikely the the direct caller will handle them. Errors that are software bug should be reported by an assert. - POSIXMutex::tid is WOM (write only memory :-) - I wonder why you don't use your own Mutex Wrapper in the ReadWriteMutex-Wrapper. - As your ReadWriteMutex favours readers over writers it can cause writer to wait for every as long as there are readers. - Your ScopeMutex is simply broken, because if proper used it can't even excessed by more than one thread. The point of a scope/lock guard is to have a device with automatic storage duration that locks a mutex in it's constructor and unlock the mutex in it's destructor and thus spanning a locked path over the scope of the automatic variable. Have a google for RAII. Boost/Threads and RougeWave/thread.h++ are two good examples of C++ threading libraries/wrappers. best regards Torsten .