Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ControlClientImpl::ControlClientImpl(std::function<void(const score::lcm::Execut

ipc_channel_ = score::lcm::internal::ControlClientChannel::initializeControlClientChannel();

ipc_request_semaphore_.init(1U, false);
static_cast<void>(ipc_request_semaphore_.init(1U, false));
ipc_response_thread_ = std::make_unique<std::thread>(&ControlClientImpl::run, this);
}

Expand All @@ -107,7 +107,7 @@ ControlClientImpl::~ControlClientImpl() noexcept {
ipc_response_thread_->join();
}

ipc_request_semaphore_.deinit();
static_cast<void>(ipc_request_semaphore_.deinit());
}

void ControlClientImpl::run() {
Expand Down Expand Up @@ -284,7 +284,7 @@ score::concurrency::InterruptibleFuture<void> ControlClientImpl::SendIpcMessage(
}

// we definitely shouldn't forget to release semaphore
ipc_request_semaphore_.post();
static_cast<void>(ipc_request_semaphore_.post());
}
else
{
Expand Down Expand Up @@ -375,7 +375,7 @@ score::Result<score::lcm::ExecutionErrorEvent> ControlClientImpl::GetExecutionEr
}

// we definitely shouldn't forget to release semaphore
ipc_request_semaphore_.post();
static_cast<void>(ipc_request_semaphore_.post());
}
// else not needed as kCommunicationError is the default return value
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct MonitorIfDaemonFixture
/// Initialize the IPC server so that peek/pop/hasOverflow use real shared memory.
void initIpc()
{
ipcServer.init(makeUniqueIpcName());
static_cast<void>(ipcServer.init(makeUniqueIpcName()));
}

/// Drive the process to the 'running' state and notify observers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace internal {

namespace osal {

int setSecurityPolicy(const char* policy);
[[nodiscard]] int setSecurityPolicy(const char* policy);

}

Expand Down
10 changes: 5 additions & 5 deletions score/launch_manager/src/daemon/src/osal/semaphore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Semaphore final {
/// @return An OsalReturnType indicating the result of the operation.
/// - `OsalReturnType::KSuccess`: The semaphore was successfully initialized.
/// - `OsalReturnType::KFail`: An error occurred during the initialization.
OsalReturnType init(uint32_t value, bool shared);
[[nodiscard]] OsalReturnType init(uint32_t value, bool shared);

/// @brief Destroys the semaphore and releases any resources associated with it.
/// This method uses `sem_destroy` to destroy the semaphore:
Expand All @@ -72,7 +72,7 @@ class Semaphore final {
/// @return An OsalReturnType indicating the result of the deinitialization.
/// - `OsalReturnType::KSuccess`: The semaphore was successfully deinitialized.
/// - `OsalReturnType::KFail`: An error occurred during the deinitialization.
OsalReturnType deinit();
[[nodiscard]] OsalReturnType deinit();

/// @brief Decrement the semaphore, blocking until the semaphore can be decremented or the timeout expires.
/// This method does not use `sem_timedwait` to attempt to decrement the semaphore because that does not use a monotonic clock.
Expand All @@ -85,7 +85,7 @@ class Semaphore final {
/// - `OsalReturnType::KSuccess`: The semaphore was successfully decremented within the specified time.
/// - `OsalReturnType::KTimeout`: The semaphore was not decremented because the wait timed out.
/// - `OsalReturnType::KFail`: An error occurred during the wait operation (e.g., if the system clock could not be read).
OsalReturnType timedWait(std::chrono::milliseconds delay);
[[nodiscard]] OsalReturnType timedWait(std::chrono::milliseconds delay);

/// @brief Increments (posts) the semaphore.
/// This method uses `sem_post` to increment the semaphore:
Expand All @@ -96,7 +96,7 @@ class Semaphore final {
/// @return An OsalReturnType indicating the result of the operation.
/// - `OsalReturnType::KSuccess`: The semaphore was successfully incremented (posted).
/// - `OsalReturnType::KFail`: An error occurred during the increment (post) operation.
OsalReturnType post();
[[nodiscard]] OsalReturnType post();

/// @brief Decrements (waits) the semaphore.
/// This method uses `sem_wait` to decrement the semaphore:
Expand All @@ -107,7 +107,7 @@ class Semaphore final {
/// @return An OsalReturnType indicating the result of the operation.
/// - `OsalReturnType::KSuccess`: The semaphore was successfully decremented (waited).
/// - `OsalReturnType::KFail`: An error occurred during the decrement (wait) operation.
OsalReturnType wait();
[[nodiscard]] OsalReturnType wait();

private:
/// @brief POSIX semaphore object
Expand Down
2 changes: 1 addition & 1 deletion score/launch_manager/src/daemon/src/osal/set_affinity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace osal {
/// currently physically on the system and permitted to the
/// thread according to any restrictions that may be imposed
/// elsewhere.
int32_t setaffinity(uint32_t cpumask) noexcept(true);
[[nodiscard]] int32_t setaffinity(uint32_t cpumask) noexcept(true);
} // namespace osal
} // namespace lcm
} // namespace internal
Expand Down
2 changes: 1 addition & 1 deletion score/launch_manager/src/daemon/src/osal/set_groups.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace osal {
/// to the underlying OS call.
/// @param __groups pointer to the list of groups, may be NULL
/// @returns 0 on success, -1 on failure.
std::int32_t setgroups(size_t __n, const gid_t *__groups) noexcept(true);
[[nodiscard]] std::int32_t setgroups(size_t __n, const gid_t *__groups) noexcept(true);
} // namespace osal
} // namespace lcm
} // namespace internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void ProcessInfoNode::terminated(int32_t process_status)
// handle the situation where a worker thread is waiting for a process to terminate
if (has_semaphore_.exchange(false))
{
terminator_.post();
static_cast<void>(terminator_.post());
}
}

Expand Down Expand Up @@ -519,7 +519,7 @@ inline void ProcessInfoNode::handleTerminationProcess()
{
auto pg_mgr = graph_->getProcessGroupManager();

terminator_.init(0U, false);
static_cast<void>(terminator_.init(0U, false));
has_semaphore_.store(true);
LM_LOG_DEBUG() << "Requesting termination of process" << process_index_ << "of" << graph_->getProcessGroupName()
<< "pid" << pid_ << "(" << config_->startup_config_.short_name_ << ")";
Expand All @@ -538,7 +538,7 @@ inline void ProcessInfoNode::handleTerminationProcess()
}

has_semaphore_.store(false);
terminator_.deinit();
static_cast<void>(terminator_.deinit());
}

inline void ProcessInfoNode::handleForcedTermination()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ namespace score::mw::lifecycle {
}

// Final post to semaphore, so LM know that communication channel can be closed now
sync->send_sync_.post();
if (sync->send_sync_.post() == OsalReturnType::kFail)
{
LM_LOG_ERROR() << "[Lifecycle Client] Final synchronization post failed.";

return comms_error;
}
// Mark as reported if successful
reported = true;
// Set return value to success
Expand Down
Loading