You have to have the resources to be controlled with Cmutex object. Then within every object trying to access this resource declare the variable that is of the type CsingleLock/CMultiLock. Calling the lock function from this access variable. If you cannot get access in some time, then timeout and continue execution or if you got access perform the functions and do the unlock over the lock variable. Now we have a thread-safe access to the specified resource guarded by the mutex.
Liked By
Write Answer
. How can you have controlled access to the resources, i.e in a thread-safe manner?
Join MindStick Community
You have need login or register for voting of answers or question.
James Smith
19-May-2011You have to have the resources to be controlled with Cmutex object. Then within every object trying to access this resource declare the variable that is of the type CsingleLock/CMultiLock. Calling the lock function from this access variable. If you cannot get access in some time, then timeout and continue execution or if you got access perform the functions and do the unlock over the lock variable. Now we have a thread-safe access to the specified resource guarded by the mutex.