[Boost-bugs] [Boost C++ Libraries] #5622: interprocess::named_semaphore::remove return value broken on POSIX systems

Subject: [Boost-bugs] [Boost C++ Libraries] #5622: interprocess::named_semaphore::remove return value broken on POSIX systems
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-06-20 19:42:26


#5622: interprocess::named_semaphore::remove return value broken on POSIX systems
-----------------------------------------------------+----------------------
 Reporter: Horst Schirmeier <horst@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-----------------------------------------------------+----------------------
 '''static bool named_semaphore::remove(const char *name)''' is documented
 as "Returns false on error", which is broken on POSIX platforms if
 BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES is enabled.

 '''named_semaphore::remove()'''
 (interprocess/sync/named_semaphore.hpp:166) calls '''static bool
 detail::named_semaphore_wrapper::remove(const char *name)''', which
 (interprocess/sync/posix/semaphore_wrapper.hpp:229) calls '''inline bool
 semaphore_unlink(const char *name)''' (:106). This function uses the
 POSIX API call sem_unlink() (:115) to do the unlinking:

 {{{ return 0 != sem_unlink(sem_str.c_str()); }}}

 This makes semaphore_unlink() return '''false''' if sem_unlink() returns
 0. POSIX' sem_unlink() is documented to return 0 on '''success''',
 though: "Upon successful completion, the sem_unlink() function shall
 return a value of 0." (POSIX API docs)
 interprocess/sync/posix/semaphore_wrapper.hpp:115 should be changed to the
 following:

 {{{ return 0 == sem_unlink(sem_str.c_str()); }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5622>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC