Originally Posted by
matsp
There really isn't much that changes - C++ is C backwards compatible, so the thread functions themselves will work just the same - they are just C functions that are called from C++.
Obviously, accessing the same object from multiple threads follow the same rules as any other type of shared data access from multiple threads - you need sufficient locks to make sure that one piece of code doesn't trample some other threads efforts. Methods are functions - the fact that they are essentially function pointers make no big difference to the functionality [as the pointers are never being written, they are generated at compile-time - or, link-time in some cases - but always before the application executes in any sense], so there is no difference between object member functions and any other functions - the function itself needs no protection, but the access within the function may do. It is the same rule as if you pass the pointer to a struct to a function - classes are structs.
One neat thing is that you can create locks with a constructor and release them with the destructor, something like this:
--
Mats