what does ReleaseSemaphore() releases?

This is a discussion on what does ReleaseSemaphore() releases? within the Windows Programming forums, part of the Platform Specific Boards category; Once I call ReleaseSemaphore(), can I re-OpenSemaphore() the Semaphore object without the need of calling for CreateSemaphore() again? btw, can ...

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    what does ReleaseSemaphore() releases?

    Once I call ReleaseSemaphore(), can I re-OpenSemaphore() the Semaphore object without the need of calling for CreateSemaphore() again?


    btw, can I use the same Semaphore for more than one thread? Or should I create a Semaphore per thread?


    Thank you.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >> Once I call ReleaseSemaphore(), can I re-OpenSemaphore() the Semaphore object without the need of calling for CreateSemaphore() again? <<

    A semaphore is destroyed once all handles to it are destroyed, either explicitly with CloseHandle or implicitly by process termination. ReleaseSemaphore increases the count of a semaphore. It does not close a semaphore. You do not need to call OpenSemaphore, a semaphore handle remains valid until you close it.

    >> btw, can I use the same Semaphore for more than one thread? <<

    Yes. There would be little point in using a semaphore with a single thread.

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    CreateSemaphore() again? <<
    I'm sorry I had to post about this again, it's just no one looked at the older posts anymore.

    ReleaseSemaphore increases the count of a semaphore
    Can you please explain alittle more about the count.


    Also, do I really need the CreateSemaphore(), can't I only use the OpenSemaphore()?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Best Buy and late releases
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 11-21-2008, 12:50 AM
  2. Stable applications?
    By audinue in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 11-16-2008, 02:48 PM
  3. Google releases information!
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-27-2004, 07:57 PM
  4. Different Releases
    By Roaring_Tiger in forum C Programming
    Replies: 3
    Last Post: 02-06-2003, 05:16 PM
  5. the many uses of DA's releases
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 12-31-2001, 11:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21