Skip to content

Commit 824e861

Browse files
committed
Fix boost::interprocess::semaphore initialization.
Signed-off-by: AdolfoMartinez <[email protected]>
1 parent 8297085 commit 824e861

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

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: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ class interprocess_semaphore
6060
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
6161
public:
6262

63-
//!Creates a interprocess_semaphore with initial count = 0.
64-
interprocess_semaphore();
65-
6663
//!Creates a interprocess_semaphore with the given initial count.
6764
//!interprocess_exception if there is an error.
6865
interprocess_semaphore(unsigned int initialCount);
@@ -116,10 +113,6 @@ class interprocess_semaphore
116113
namespace boost {
117114
namespace interprocess {
118115

119-
inline interprocess_semaphore::interprocess_semaphore()
120-
: m_sem(0)
121-
{}
122-
123116
inline interprocess_semaphore::interprocess_semaphore(unsigned int initialCount)
124117
: m_sem(initialCount)
125118
{}

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)