Thread Sync Objects...
-
Hi all, I am quite aware of the working of the thread synchronisation objects like, event, mutex, Critical Section, semaphore...etc... I know each of it's working individually, but can anybody let me know, 1)what is the advantage ,disadvantage over other.. 2)when each of the one is best to use.. I had check out various sources to find this info...But I am not convinced nor it explains me only the concepts... Thanks a lot, Shiva P
-
Hi all, I am quite aware of the working of the thread synchronisation objects like, event, mutex, Critical Section, semaphore...etc... I know each of it's working individually, but can anybody let me know, 1)what is the advantage ,disadvantage over other.. 2)when each of the one is best to use.. I had check out various sources to find this info...But I am not convinced nor it explains me only the concepts... Thanks a lot, Shiva P
There is no "best" of those objects, because they have different purposes. The only comparison that makes sense is mutex vs. critical section. Those two do the same job, but mutexes are visible to the whole machine, whereas critical sections are not. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber CP SearchBar v2.0.2 released
-
There is no "best" of those objects, because they have different purposes. The only comparison that makes sense is mutex vs. critical section. Those two do the same job, but mutexes are visible to the whole machine, whereas critical sections are not. --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber CP SearchBar v2.0.2 released
-
mutexes are only visible to the whole machine when you have specified a name, correct me if i'm wrong.
If you don't name them you can't look them up by name in another process, but you can still use them in another process if the handle is passed there in some other fashion. Have a look at DuplicateHandle(). -- -Blake (com/bcdev/blake)
-
If you don't name them you can't look them up by name in another process, but you can still use them in another process if the handle is passed there in some other fashion. Have a look at DuplicateHandle(). -- -Blake (com/bcdev/blake)
-
If the sync is only for the current process then use critical-section since it's faster than mutex. in Mutex you will always have context switch to kernel mode , whereas in critical section you stay in user mode when there is no contention.