Skip to content

Commit 4b8ef7b

Browse files
Data structures interfaces for multi-threaded executor (#355)
* added custom pointer in data structures Signed-off-by: Jan Staschulat <[email protected]> * added executor type Signed-off-by: Jan Staschulat <[email protected]> * renamed struct Signed-off-by: Jan Staschulat <[email protected]> --------- Signed-off-by: Jan Staschulat <[email protected]>
1 parent 688bd28 commit 4b8ef7b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

rclc/include/rclc/executor.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,29 @@ typedef enum
5050
LET
5151
} rclc_executor_semantics_t;
5252

53+
typedef enum
54+
{
55+
NONE,
56+
SINGLE_THREADED,
57+
MULTI_THREADED,
58+
NON_POSIX,
59+
} rclc_executor_type_t;
60+
5361
/// Type definition for trigger function. With the parameters:
5462
/// - array of executor_handles
5563
/// - size of array
5664
/// - application specific struct used in the trigger function
5765
typedef bool (* rclc_executor_trigger_t)(rclc_executor_handle_t *, unsigned int, void *);
5866

67+
/// function pointer specification
68+
typedef struct rclc_executor_t_s rclc_executor_t;
69+
typedef rcl_ret_t (* rclc_executor_func_t)(rclc_executor_t *);
70+
5971
/// Container for RCLC-Executor
60-
typedef struct
72+
struct rclc_executor_t_s
6173
{
74+
/// Type of Executor
75+
rclc_executor_type_t type;
6276
/// Context (to get information if ROS is up-and-running)
6377
rcl_context_t * context;
6478
/// Container for dynamic array for DDS-handles
@@ -83,7 +97,9 @@ typedef struct
8397
void * trigger_object;
8498
/// data communication semantics
8599
rclc_executor_semantics_t data_comm_semantics;
86-
} rclc_executor_t;
100+
/// pointer to custom executor data structure
101+
void * custom;
102+
};
87103

88104
/**
89105
* Return a rclc_executor_t struct with pointer members initialized to `NULL`

rclc/include/rclc/executor_handle.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ typedef struct
165165
/// Interval variable. Flag, which is true, if new data is available from DDS queue
166166
/// (is set after calling rcl_take)
167167
bool data_available;
168+
/// pointer to custom handle
169+
void * custom;
168170
} rclc_executor_handle_t;
169171

170172
/// Information about total number of subscriptions, guard_conditions, timers, subscription etc.

0 commit comments

Comments
 (0)