muthuis
February 22nd, 2002, 08:24 AM
Can some body explain & give some sample code for the following synchronization objects.
1. Mutexes
2. Semaphores
The code can be in MFC/SDK.
1. Mutexes
2. Semaphores
The code can be in MFC/SDK.
|
Click to See Complete Forum and Search --> : Mutex & Semaphore muthuis February 22nd, 2002, 08:24 AM Can some body explain & give some sample code for the following synchronization objects. 1. Mutexes 2. Semaphores The code can be in MFC/SDK. Andreas Masur February 22nd, 2002, 08:35 AM A mutex is also a semaphore therefore is would be hard to explain where are the differences. ;-) Nevertheless synchronization is a important issue when it comes down to multithreaded applications. Synchronization is needed when access to a resource must be controlled to ensure integrity of the resource. Synchronization access objects are used to gain access to these controlled resources. There are several objects depending on the operation system. In Windows MFC provides wrapper classes for critical sections, mutex, events etc. Take a look at the following: http://www.codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=322125 http://www.codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=328935 These are two examples how to use critical sections and mutexes... Ciao, Andreas "Software is like sex, it's better when it's free." - Linus Torvalds myron October 18th, 2005, 12:10 AM Semaphore resource can have more than one acess, while Mutex can just have one. Marc G October 18th, 2005, 03:01 AM [ moved thread ] Marc G October 18th, 2005, 03:05 AM Why are you bringing several ancient threads back to life :confused: codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved. |