Skip to content

Commit be1afe5

Browse files
Adding default ctor to interprocess_semaphore (#1169)
* Fix build fail in ROS-CI. Signed-off-by: AdolfoMartinez <[email protected]> * Apply suggestions from code review Signed-off-by: Miguel Company <[email protected]> * Fix boost::interprocess::semaphore initialization. Signed-off-by: AdolfoMartinez <[email protected]> * Fix CXX_STANDARD on boost try_compile Co-authored-by: Miguel Company <[email protected]>
1 parent 194fb24 commit be1afe5

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

cmake/modules/FindThirdpartyBoost.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ try_compile(IS_THIRDPARTY_BOOST_OK
2323
${CMAKE_BINARY_DIR}
2424
${PROJECT_SOURCE_DIR}/thirdparty/boost/test/ThirdpartyBoostCompile_test.cpp
2525
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${THIRDPARTY_BOOST_INCLUDE_DIR}"
26+
CXX_STANDARD 11
2627
LINK_LIBRARIES ${THIRDPARTY_BOOST_LINK_LIBS}
2728
OUTPUT_VARIABLE OUT
2829
)

src/cpp/rtps/transport/shared_mem/RobustInterprocessCondition.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class RobustInterprocessCondition
161161

162162
struct SemaphoreNode
163163
{
164-
bi::interprocess_semaphore sem;
164+
bi::interprocess_semaphore sem {0};
165165
uint32_t next;
166166
uint32_t prev;
167167
};

thirdparty/boost/include/boost/interprocess/sync/interprocess_semaphore.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ class interprocess_semaphore
5959
interprocess_semaphore &operator=(const interprocess_semaphore &);
6060
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
6161
public:
62+
6263
//!Creates a interprocess_semaphore with the given initial count.
63-
//!interprocess_exception if there is an error.*/
64-
interprocess_semaphore(unsigned int initialCount = 0);
64+
//!interprocess_exception if there is an error.
65+
interprocess_semaphore(unsigned int initialCount);
6566

6667
//!Destroys the interprocess_semaphore.
6768
//!Does not throw

thirdparty/boost/test/ThirdpartyBoostCompile_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <boost/interprocess/managed_shared_memory.hpp>
1717
#include <boost/interprocess/sync/interprocess_condition.hpp>
1818
#include <boost/interprocess/sync/named_mutex.hpp>
19+
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
1920
#include <boost/interprocess/offset_ptr.hpp>
2021
#include <boost/thread/thread_time.hpp>
2122

@@ -31,6 +32,7 @@ class ThirdpartyBoostCompileTest
3132
ThirdpartyBoostCompileTest()
3233
{
3334
boost::interprocess::named_mutex::remove("foo");
35+
boost::interprocess::interprocess_semaphore sem {0};
3436

3537
try
3638
{

0 commit comments

Comments
 (0)