@@ -115,24 +115,15 @@ impl WaitSet {
115
115
}
116
116
} ;
117
117
118
- dbg ! ( timeout_ns) ;
119
118
// SAFETY: The comments in rcl mention "This function cannot operate on the same wait set
120
119
// in multiple threads, and the wait sets may not share content."
120
+ // * The we have exclusive access to rcl_wait_set because this is a
121
+ // mutable borrow of WaitSet, which houses rcl_wait_set.
121
122
// * We guarantee that the wait sets do not share content by funneling
122
- // the exeuctor of each primitive to one (and only one) WaitSet when
123
- // the primitive gets constructed. The primitive executors are never
124
- // allowed to transfer wait sets.
125
- // * The rcl_wait_set is kept valid by the lifecycle of the WaitSet struct.
126
- match unsafe { rcl_wait ( & mut self . handle . rcl_wait_set , timeout_ns) } . ok ( ) {
127
- Ok ( _) => ( ) ,
128
- Err ( error) => match error {
129
- RclrsError :: RclError { code, msg } => match code {
130
- RclReturnCode :: WaitSetEmpty => ( ) ,
131
- _ => return Err ( RclrsError :: RclError { code, msg } ) ,
132
- } ,
133
- _ => return Err ( error) ,
134
- } ,
135
- }
123
+ // the waitable of each primitive to one (and only one) WaitSet when
124
+ // the primitive gets constructed. The waitables are never allowed to
125
+ // move between wait sets.
126
+ let r = unsafe { rcl_wait ( & mut self . handle . rcl_wait_set , timeout_ns) } . ok ( ) ;
136
127
137
128
// Remove any waitables that are no longer being used
138
129
for waitable in self . primitives . values_mut ( ) {
@@ -164,7 +155,16 @@ impl WaitSet {
164
155
) ;
165
156
}
166
157
167
- Ok ( ( ) )
158
+ match r {
159
+ Ok ( _) => Ok ( ( ) ) ,
160
+ Err ( error) => match error {
161
+ RclrsError :: RclError { code, msg } => match code {
162
+ RclReturnCode :: WaitSetEmpty => Ok ( ( ) ) ,
163
+ _ => Err ( RclrsError :: RclError { code, msg } ) ,
164
+ } ,
165
+ _ => Err ( error) ,
166
+ } ,
167
+ }
168
168
}
169
169
170
170
/// Get a count of the different kinds of entities in the wait set.
0 commit comments