Boost logo

Boost Users :

From: Wesley Khandavalli (wesleyk_at_[hidden])
Date: 2008-08-29 04:35:54


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net