Dear all,
i am new to threading.
i want to know the following.
Given a shared object which is accessed by more than one process, where should we implement the mutex locking? Is it in the shared object or in the critical section of the Processes?
If locking is done in process, will it work having different names for the locks in the processes?
class A
{
..........
........
public:
execute()
{
.........
lock(mutex1)
//write data to shared object
unlock(mutex1)
.........
}
};
class B
{
..........
........
public:
execute()
{
.........
lock(mutex2)
//write data to shared object
unlock(mutex2)
.........
}
};
SharedObject
{
...........
..........
};
--
Wesley K