haukepetersen commented on a change in pull request #753: npl/riot: Improve 
timer glue code
URL: https://github.com/apache/mynewt-nimble/pull/753#discussion_r378759196
 
 

 ##########
 File path: porting/npl/riot/include/nimble/nimble_npl_os.h
 ##########
 @@ -100,7 +100,8 @@ ble_npl_eventq_get(struct ble_npl_eventq *evq, 
ble_npl_time_t tmo)
     } else if (tmo == BLE_NPL_TIME_FOREVER) {
         return (struct ble_npl_event *)event_wait(&evq->q);
     } else {
-        return (struct ble_npl_event *)event_wait_timeout(&evq->q, (tmo * 
1000));
+        return (struct ble_npl_event *)event_wait_timeout(&evq->q,
+                                                          (tmo * US_PER_MS));
 
 Review comment:
   If I am not mistaken, a source for error remains for this call: if `tmo`s 
value is greater than (UINT32T_MAX / 1000 -> 1,19 hours), the timeout will be 
set incorrectly. Looking at RIOTs µs-based timer APIs it seems this can not be 
so easily solved. But how about we a) put in an assert that triggers once this 
overflow happens, or b) return NULL in that case, which subsequently would also 
in most cases trigger an assertion by the calling code...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to