Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass context to wait set #258

Merged
merged 1 commit into from
Jan 25, 2019
Merged
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
3 changes: 2 additions & 1 deletion rclpy/rclpy/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ def _wait_for_ready_callbacks(self, timeout_sec=None, nodes=None):
entity_count.num_guard_conditions,
entity_count.num_timers,
entity_count.num_clients,
entity_count.num_services)
entity_count.num_services,
self._context.handle)

entities = {
'subscription': (subscriptions, 'subscription_handle'),
Expand Down
13 changes: 10 additions & 3 deletions rclpy/src/rclpy/_rclpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,11 +2279,12 @@ rclpy_wait_set_init(PyObject * Py_UNUSED(self), PyObject * args)
unsigned PY_LONG_LONG number_of_timers;
unsigned PY_LONG_LONG number_of_clients;
unsigned PY_LONG_LONG number_of_services;
PyObject * pycontext;

if (!PyArg_ParseTuple(
args, "OKKKKK", &pywait_set, &number_of_subscriptions,
args, "OKKKKKO", &pywait_set, &number_of_subscriptions,
&number_of_guard_conditions, &number_of_timers,
&number_of_clients, &number_of_services))
&number_of_clients, &number_of_services, &pycontext))
{
return NULL;
}
Expand All @@ -2292,9 +2293,15 @@ rclpy_wait_set_init(PyObject * Py_UNUSED(self), PyObject * args)
if (!wait_set) {
return NULL;
}

rcl_context_t * context = (rcl_context_t *)PyCapsule_GetPointer(pycontext, "rcl_context_t");
if (NULL == context) {
return NULL;
}

rcl_ret_t ret = rcl_wait_set_init(
wait_set, number_of_subscriptions, number_of_guard_conditions, number_of_timers,
number_of_clients, number_of_services, rcl_get_default_allocator());
number_of_clients, number_of_services, context, rcl_get_default_allocator());
if (ret != RCL_RET_OK) {
PyErr_Format(PyExc_RuntimeError,
"Failed to initialize wait set: %s", rcl_get_error_string().str);
Expand Down