Skip to content

Commit

Permalink
iox-eclipse-iceoryx#751 Release note simplified, m_ added for consist…
Browse files Browse the repository at this point in the history
…ency reasons, fix issue in SignalWatcher test

Signed-off-by: Christian Eltzschig <me@elchris.org>
  • Loading branch information
elfenpiff committed Jun 20, 2022
1 parent 2820758 commit 8ad4e5d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 45 deletions.
81 changes: 42 additions & 39 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,58 +79,61 @@
#include "iceoryx_hoofs/design_pattern/builder.hpp"
```

3. Replace `Semaphore` with `NamedSemaphore` and `UnnamedSemaphore`
3. `UnnamedSemaphore` replaces `Semaphore` with `CreateUnnamed*` option

```cpp
// before
#include "iceoryx_hoofs/posix_wrapper/semaphore.hpp"
#include "iceoryx_hoofs/posix_wrapper/semaphore.hpp"

// named semaphore
auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateNamedSemaphore,
"mySemaphoreName",
S_IRUSR | S_IWUSR,
0);
auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateUnnamedSingleProcessSemaphore, 0);

// after
#include "iceoryx_hoofs/posix_wrapper/unnamed_semaphore.hpp"

iox::cxx::optional<iox::posix::UnnamedSemaphore> semaphore;
auto result = iox::posix::UnnamedSemaphoreBuilder()
.initialValue(0U)
.isInterProcessCapable(true)
.create(semaphore);
```

// unnamed semaphore
auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateUnnamedSingleProcessSemaphore, 0);
4. `NamedSemaphore` replaces `Semaphore` with `CreateNamedSemaphore` option

```cpp
// before
#include "iceoryx_hoofs/posix_wrapper/semaphore.hpp"

auto semaphore = iox::posix::Semaphore::create(iox::posix::CreateNamedSemaphore,
"mySemaphoreName",
S_IRUSR | S_IWUSR,
0);
// after
// named semaphore
#include "iceoryx_hoofs/posix_wrapper/named_semaphore.hpp"

iox::cxx::optional<iox::posix::NamedSemaphore> semaphore;
auto result = iox::posix::NamedSemaphoreBuilder()
.name("mySemaphoreName")
.openMode(iox::posix::OpenMode::OPEN_OR_CREATE)
.permissions(iox::cxx::perms::owner_all)
.initialValue(0U)
.create(semaphore);

// unnamed semaphore
#include "iceoryx_hoofs/posix_wrapper/unnamed_semaphore.hpp"

iox::cxx::optional<iox::posix::UnnamedSemaphore> semaphore;
auto result = iox::posix::UnnamedSemaphoreBuilder()
.initialValue(0U)
.isInterProcessCapable(true)
.create(semaphore);
#include "iceoryx_hoofs/posix_wrapper/named_semaphore.hpp"

iox::cxx::optional<iox::posix::NamedSemaphore> semaphore;
auto result = iox::posix::NamedSemaphoreBuilder()
.name("mySemaphoreName")
.openMode(iox::posix::OpenMode::OPEN_OR_CREATE)
.permissions(iox::cxx::perms::owner_all)
.initialValue(0U)
.create(semaphore);
```

4. `RoudiApp::waitForSignal` is deprecated
5. `RoudiApp::waitForSignal` is deprecated
```cpp
// before
// in my custom roudi app implementation
uint8_t MyCustomRoudiApp::run() noexcept {
// ...
//// in my custom roudi app implementation
uint8_t MyCustomRoudiApp::run() noexcept {
// ...

waitForSignal();
}
waitForSignal();
}

// after
// in my custom roudi app implementation
uint8_t MyCustomRoudiApp::run() noexcept {
// ...
//// in my custom roudi app implementation
uint8_t MyCustomRoudiApp::run() noexcept {
// ...

iox::posix::waitForTerminationRequest();
}
iox::posix::waitForTerminationRequest();
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void unblocksWhenSignalWasRaisedForWaiters(SignalWatcher_test& test,
});
}

iox::cxx::internal::adaptive_wait().wait_loop([&] { return !isThreadStarted; });
iox::cxx::internal::adaptive_wait().wait_loop([&] { return (isThreadStarted != numberOfWaiters); });

std::this_thread::sleep_for(test.waitingTime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ConditionVariableData
RuntimeName_t m_runtimeName;
std::atomic_bool m_toBeDestroyed{false};
std::atomic_bool m_activeNotifications[MAX_NUMBER_OF_NOTIFIERS];
std::atomic_bool wasNotified{false};
std::atomic_bool m_wasNotified{false};
};

} // namespace popo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ConditionListener::destroy() noexcept

bool ConditionListener::wasNotified() const noexcept
{
return getMembers()->wasNotified.load(std::memory_order_relaxed);
return getMembers()->m_wasNotified.load(std::memory_order_relaxed);
}

ConditionListener::NotificationVector_t ConditionListener::wait() noexcept
Expand Down Expand Up @@ -110,7 +110,7 @@ ConditionListener::NotificationVector_t ConditionListener::waitImpl(const cxx::f
void ConditionListener::reset(const uint64_t index) noexcept
{
getMembers()->m_activeNotifications[index].store(false, std::memory_order_relaxed);
getMembers()->wasNotified.store(false, std::memory_order_relaxed);
getMembers()->m_wasNotified.store(false, std::memory_order_relaxed);
}

const ConditionVariableData* ConditionListener::getMembers() const noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ConditionNotifier::ConditionNotifier(ConditionVariableData& condVarDataRef, cons
void ConditionNotifier::notify() noexcept
{
getMembers()->m_activeNotifications[m_notificationIndex].store(true, std::memory_order_release);
getMembers()->wasNotified.store(true, std::memory_order_relaxed);
getMembers()->m_wasNotified.store(true, std::memory_order_relaxed);
getMembers()->semaphore->post().or_else(
[](auto) { errorHandler(PoshError::POPO__CONDITION_NOTIFIER_SEMAPHORE_CORRUPT_IN_NOTIFY, ErrorLevel::FATAL); });
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2019 - 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2019 - 2020 by Apex.AI Inc. All rights reserved.
// Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 8ad4e5d

Please sign in to comment.