Results 1 to 5 of 5
Hi All,
I have written one app that contains 3 different threads. I used mutex to handle the shared/ global data within this app. I have written different mutex for ...
- 01-15-2009 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 50
mutex around the threads
Hi All,
I have written one app that contains 3 different threads. I used mutex to handle the shared/ global data within this app. I have written different mutex for each thread ie. 3 mutex and not used mutex within main().
Is it right? or Will I have to use single mutex for all threads even for main() ?
Please guide me on this.
Thanks,
Pankaj.
- 01-19-2009 #2Just Joined!
- Join Date
- Feb 2008
- Posts
- 50
Plz answer on this...
- 01-19-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 4
Re : mutex around the threads
Hi pankaj,
No, it's not right. U need to take single global mutex for all three threads for shared data access by each thread at one time only. if u'll take different mutex for each thread then each mutex would be local for that thread and won't provide control to prevent shared data access from other threads if one out of three threads accessing shared global data.
Use single global mutex and use it in threads.
- 01-20-2009 #4Just Joined!
- Join Date
- Feb 2008
- Posts
- 50
Thanks Tarun, Do you have some ebook link to more focus on this topic!
- 01-20-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 4
Re : mutex around the threads
Hi pankaj,
It's good book for study on IPC mechanism that describes mutexes also well.
UNIX Network Programming, Volume 2: Interprocess Communications (2nd Edition)
By : Richard Stevens
i don't kno link to download it.
you search for it and get it.


Reply With Quote