Skip to content

Commit

Permalink
Preparing for use of rcl_wait_set_is_valid.
Browse files Browse the repository at this point in the history
Signed-off-by: Staschulat Jan <jan.staschulat@de.bosch.com>
  • Loading branch information
JanStaschulat committed Dec 10, 2019
1 parent 8e03acd commit 0273e3e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions rcl_executor/include/rcl_executor/let_executor.h
Expand Up @@ -48,8 +48,6 @@ typedef struct
const rcl_allocator_t * allocator;
/// Wait set (is initialized only in the first call of the rcle_let_executor_spin_some function)
rcl_wait_set_t wait_set;
/// wait_set is valid
bool wait_set_valid;
/// Statistics objects about total number of subscriptions, timers, clients, services, etc.
rcle_handle_size_t info;
/// timeout in nanoseconds for rcl_wait() used in rcle_let_executor_spin_once(). Default 100ms
Expand Down
6 changes: 1 addition & 5 deletions rcl_executor/src/let_executor.c
Expand Up @@ -76,7 +76,6 @@ rcle_let_executor_get_zero_initialized_executor()
.max_handles = 0,
.index = 0,
.allocator = NULL,
.wait_set_valid = false,
.timeout_ns = 0
};
return null_executor;
Expand All @@ -103,7 +102,6 @@ rcle_let_executor_init(
executor->max_handles = number_of_handles;
executor->index = 0;
executor->wait_set = rcl_get_zero_initialized_wait_set();
executor->wait_set_valid = false;
executor->allocator = allocator;
executor->timeout_ns = DEFAULT_WAIT_TIMEOUT_MS;
// allocate memory for the array
Expand Down Expand Up @@ -152,12 +150,11 @@ rcle_let_executor_fini(rcle_let_executor_t * executor)

// free memory of wait_set if it has been initialized
// calling it with un-initialized wait_set will fail.
if (executor->wait_set_valid) {
if (rcl_wait_set_is_valid(&executor->wait_set)) {
rcl_ret_t rc = rcl_wait_set_fini(&executor->wait_set);
if (rc != RCL_RET_OK) {
PRINT_RCL_ERROR(rcle_let_executor_fini, rcl_wait_set_fini);
}
executor->wait_set_valid = false;
}
executor->timeout_ns = DEFAULT_WAIT_TIMEOUT_MS;
} else {
Expand Down Expand Up @@ -409,7 +406,6 @@ rcle_let_executor_spin_some(rcle_let_executor_t * executor, const uint64_t timeo
RCL_CHECK_ARGUMENT_FOR_NULL(executor, RCL_RET_INVALID_ARGUMENT);
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "spin_some");

// the wait_set is initialized only once (aka in the first call of this function)
if (executor->wait_set_valid == false) {
// we assume that this is the first time and init has been called
// or some _add function has been called after spin_some and thereby
Expand Down

0 comments on commit 0273e3e

Please sign in to comment.