CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Location
    Pasadena, CA
    Posts
    48

    CreateSemaphore WIN32 Interface

    What is the maximum value that a semaphore can have? The CreateSemaphore takes in two LONGs for the inital and maximal value but passing in std::numeric_limits<LONG>::max() causes CreateSemaphore to fail (returning NULL).

    Is there a documented max or #define magic constant defining the maximal count?
    The views expressed are those of the author and do not reflect any position taken by the Goverment of the United States of America, National Aeronautics and Space Administration (NASA), Jet Propulsion Laboratory (JPL), or California Institute of Technology (CalTech)

  2. #2
    Join Date
    Feb 2002
    Posts
    5,757
    What is the error?

    What is the exact numeric value that std::numeric_limits<LONG>::max() returns?

    Kuphryn

  3. #3
    Join Date
    Nov 2003
    Location
    Pasadena, CA
    Posts
    48
    std::numeric_limits<LONG>::max() returns an implementation defined value of type LONG that represents the largest possible positive value for the LONG datatype (ie. biggest integral value long can hold).
    The views expressed are those of the author and do not reflect any position taken by the Goverment of the United States of America, National Aeronautics and Space Administration (NASA), Jet Propulsion Laboratory (JPL), or California Institute of Technology (CalTech)

  4. #4
    Join Date
    Feb 2002
    Posts
    5,757
    Correct.

    Run the application in debug mode. What is the exact numeric value that std::numeric_limits<LONG>::max() returns?

    Kuphryn

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: CreateSemaphore WIN32 Interface

    Originally posted by mclark
    What is the maximum value that a semaphore can have? The CreateSemaphore takes in two LONGs for the inital and maximal value but passing in std::numeric_limits<LONG>::max() causes CreateSemaphore to fail (returning NULL).
    As usual...what does 'GetLastError()' return?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured