Author Topic: Synchronization - Semaphore - CSemaphore, CSingleLock, WaitForSingleObject  (Read 1421 times)


  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Semaphore objects are used to control the number of instances running and synchronize between multiple processes rather than multithread. It behaves as if Mutex but the maximum number of instances can be set while creating semaphore.

In this example, I have written one application using Semaphore. It will allow running of the same application to the maximum of 3 times. After that if you try to run the same application, then it will display the message " You have reached running the maximum number of instances of this application." and then it will exit.

For more details, visit at


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1