Incorporate rmw_waitset
This commit is contained in:
parent
6d25f56568
commit
d6ea437dce
1 changed files with 16 additions and 1 deletions
|
@ -115,7 +115,10 @@ rcl_wait_set_init(
|
||||||
wait_set->impl->rmw_guard_conditions.guard_conditions = NULL;
|
wait_set->impl->rmw_guard_conditions.guard_conditions = NULL;
|
||||||
wait_set->impl->rmw_guard_conditions.guard_condition_count = 0;
|
wait_set->impl->rmw_guard_conditions.guard_condition_count = 0;
|
||||||
wait_set->impl->rmw_waitset = rmw_create_waitset(
|
wait_set->impl->rmw_waitset = rmw_create_waitset(
|
||||||
NULL, 2*number_of_subscriptions + number_of_guard_conditions);
|
NULL, 2 * number_of_subscriptions + number_of_guard_conditions);
|
||||||
|
if (!wait_set->impl->rmw_waitset) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize subscription space.
|
// Initialize subscription space.
|
||||||
rcl_ret_t ret;
|
rcl_ret_t ret;
|
||||||
|
@ -151,6 +154,12 @@ rcl_wait_set_init(
|
||||||
wait_set->impl->allocator = allocator;
|
wait_set->impl->allocator = allocator;
|
||||||
return RCL_RET_OK;
|
return RCL_RET_OK;
|
||||||
fail:
|
fail:
|
||||||
|
if (__wait_set_is_valid(wait_set)) {
|
||||||
|
rmw_ret_t ret = rmw_destroy_waitset(wait_set->impl->rmw_waitset);
|
||||||
|
if (ret != RMW_RET_OK) {
|
||||||
|
fail_ret = RCL_RET_WAIT_SET_INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
__wait_set_clean_up(wait_set, allocator);
|
__wait_set_clean_up(wait_set, allocator);
|
||||||
return fail_ret;
|
return fail_ret;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +169,13 @@ rcl_wait_set_fini(rcl_wait_set_t * wait_set)
|
||||||
{
|
{
|
||||||
rcl_ret_t result = RCL_RET_OK;
|
rcl_ret_t result = RCL_RET_OK;
|
||||||
RCL_CHECK_ARGUMENT_FOR_NULL(wait_set, RCL_RET_INVALID_ARGUMENT);
|
RCL_CHECK_ARGUMENT_FOR_NULL(wait_set, RCL_RET_INVALID_ARGUMENT);
|
||||||
|
|
||||||
if (__wait_set_is_valid(wait_set)) {
|
if (__wait_set_is_valid(wait_set)) {
|
||||||
|
rmw_ret_t ret = rmw_destroy_waitset(wait_set->impl->rmw_waitset);
|
||||||
|
if (ret != RMW_RET_OK) {
|
||||||
|
RCL_SET_ERROR_MSG(rmw_get_error_string_safe());
|
||||||
|
result = RCL_RET_WAIT_SET_INVALID;
|
||||||
|
}
|
||||||
__wait_set_clean_up(wait_set, wait_set->impl->allocator);
|
__wait_set_clean_up(wait_set, wait_set->impl->allocator);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue