mutex multi process sharing question

M

mazzawi

I know they can be shared if we use
pthread_mutexattr_setpshared with PTHREAD_PROCESS_SHARED

but does that only work if the processes are created with a fork,
after the mutex has been declared, ie

pthread_mutex_t DBMutex; /* mutex id */
fork();

so the processes know where to find the mutex.

but what if we have 2 indepednant processes. that are started
separately not forked. is there a way to use the pthread_mutex, or do
i have to use semaphores.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top