. HOW CAN YOU HAVE CONTROLLED ACCESS TO THE RESOURCES, I.E IN A THREAD-SAFE MANNER?

James Smith

Total Post:79

Points:395
Posted by  James Smith
 1549  View(s)
Ratings:
Rate this:
  1. James Smith

    Post:79

    Points:395
    . How can you have controlled access to the resources, i.e in a thread-safe manner?

    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 funtion 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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!