Skip to content

Commit

Permalink
waitset -> wait_set (#131)
Browse files Browse the repository at this point in the history
* waitset -> wait_set

* use wait set in docblocks
  • Loading branch information
mikaelarguedas authored Nov 27, 2017
1 parent 5ac047a commit 2e67c4a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions rmw/include/rmw/allocators.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ void
rmw_service_free(rmw_service_t * service);

RMW_PUBLIC
rmw_waitset_t *
rmw_waitset_allocate(void);
rmw_wait_set_t *
rmw_wait_set_allocate(void);

RMW_PUBLIC
void
rmw_waitset_free(rmw_waitset_t * waitset);
rmw_wait_set_free(rmw_wait_set_t * wait_set);

#if __cplusplus
}
Expand Down
24 changes: 12 additions & 12 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,33 +277,33 @@ RMW_WARN_UNUSED
rmw_ret_t
rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition);

/// Create a waitset to store conditions that the middleware will block on.
/// Create a wait set to store conditions that the middleware will block on.
/**
* If `max_conditions` is `0`, the waitset can store an unbounded number of
* If `max_conditions` is `0`, the wait set can store an unbounded number of
* conditions to wait on.
* If `max_conditions` is greater than `0`, the number of conditions that can
* be attached to the waitset is bounded at `max_conditions`.
* be attached to the wait set is bounded at `max_conditions`.
* \param[in] max_conditions
* The maximum number of conditions that can be attached to the waitset.
* \return A pointer to the created waitset, `NULL` if an error occurred.
* The maximum number of conditions that can be attached to the wait set.
* \return A pointer to the created wait set, `NULL` if an error occurred.
*/
RMW_PUBLIC
RMW_WARN_UNUSED
rmw_waitset_t *
rmw_create_waitset(size_t max_conditions);
rmw_wait_set_t *
rmw_create_wait_set(size_t max_conditions);

RMW_PUBLIC
RMW_WARN_UNUSED
rmw_ret_t
rmw_destroy_waitset(rmw_waitset_t * waitset);
rmw_destroy_wait_set(rmw_wait_set_t * wait_set);

/// Waits on sets of different waitable entities and returns when one is ready.
/**
* Add conditions to the wait set and wait until a response comes in, or until
* the timeout is reached.
* The arrays contain type-erased representations of waitable entities.
* This function casts the pointers to middleware-specific conditions and adds
* them to the waitset.
* them to the wait set.
*
* The count variables in the arrays represents the number of valid pointers
* in the array.
Expand All @@ -321,12 +321,12 @@ rmw_destroy_waitset(rmw_waitset_t * waitset);
* \param guard_conditions Array of guard conditions to wait on
* \param services Array of services to wait on
* \param clients Array of clients to wait on
* \param waitset Storage for the waitset
* \param wait_set Storage for the wait set
* \param wait_timeout
* If negative, block indefinitely or until a condition is ready.
* If zero, check only for immediately available conditions and don't block.
* Else, this represents the maximum time to wait for a response from the
* waitset.
* wait set.
* \return `RMW_RET_OK` if success, or
* \return `RMW_RET_ERROR` if error, or
* \return `RMW_RET_TIMEOUT` if wait timed out.
Expand All @@ -339,7 +339,7 @@ rmw_wait(
rmw_guard_conditions_t * guard_conditions,
rmw_services_t * services,
rmw_clients_t * clients,
rmw_waitset_t * waitset,
rmw_wait_set_t * wait_set,
const rmw_time_t * wait_timeout);

RMW_PUBLIC
Expand Down
4 changes: 2 additions & 2 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ typedef struct RMW_PUBLIC_TYPE rmw_guard_conditions_t
void ** guard_conditions;
} rmw_guard_conditions_t;

typedef struct RMW_PUBLIC_TYPE rmw_waitset_t
typedef struct RMW_PUBLIC_TYPE rmw_wait_set_t
{
const char * implementation_identifier;
rmw_guard_conditions_t * guard_conditions;
void * data;
} rmw_waitset_t;
} rmw_wait_set_t;

typedef struct RMW_PUBLIC_TYPE rmw_request_id_t
{
Expand Down
12 changes: 6 additions & 6 deletions rmw/src/allocators.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ rmw_service_free(rmw_service_t * service)
rmw_free(service);
}

rmw_waitset_t *
rmw_waitset_allocate()
rmw_wait_set_t *
rmw_wait_set_allocate()
{
// Could be overridden with custom (maybe static) client struct allocator
return (rmw_waitset_t *)rmw_allocate(sizeof(rmw_waitset_t));
return (rmw_wait_set_t *)rmw_allocate(sizeof(rmw_wait_set_t));
}

void
rmw_waitset_free(rmw_waitset_t * waitset)
rmw_wait_set_free(rmw_wait_set_t * wait_set)
{
// Should have matching overide with rmw_waitset_allocate
rmw_free(waitset);
// Should have matching overide with rmw_wait_set_allocate
rmw_free(wait_set);
}

0 comments on commit 2e67c4a

Please sign in to comment.