You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/08/04 07:01:56 UTC
[mynewt-nimble] branch master updated: porting/npl/nuttx: fix callout_handler implement
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new a77acc42 porting/npl/nuttx: fix callout_handler implement
a77acc42 is described below
commit a77acc42509f5bc9c57cbbaf8057b0c6c6b749a6
Author: larry <la...@transtekcorp.com>
AuthorDate: Fri Jul 15 14:23:03 2022 +0800
porting/npl/nuttx: fix callout_handler implement
callout_thread is working for all timeout callout, it need
an endless loop to catch all message.
---
porting/npl/nuttx/src/os_callout.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/porting/npl/nuttx/src/os_callout.c b/porting/npl/nuttx/src/os_callout.c
index e4580da9..eb69bb8b 100644
--- a/porting/npl/nuttx/src/os_callout.c
+++ b/porting/npl/nuttx/src/os_callout.c
@@ -44,21 +44,23 @@ callout_handler(pthread_addr_t arg)
{
struct ble_npl_callout *c;
- pthread_mutex_lock(&callout_mutex);
- while (!pending_callout) {
- pthread_cond_wait(&callout_cond, &callout_mutex);
- }
-
- c = pending_callout;
- pending_callout = NULL;
- pthread_mutex_unlock(&callout_mutex);
-
- /* Invoke callback */
-
- if (c->c_evq) {
- ble_npl_eventq_put(c->c_evq, &c->c_ev);
- } else {
- c->c_ev.ev_cb(&c->c_ev);
+ while (true) {
+ pthread_mutex_lock(&callout_mutex);
+ while (!pending_callout) {
+ pthread_cond_wait(&callout_cond, &callout_mutex);
+ }
+
+ c = pending_callout;
+ pending_callout = NULL;
+ pthread_mutex_unlock(&callout_mutex);
+
+ /* Invoke callback */
+
+ if (c->c_evq) {
+ ble_npl_eventq_put(c->c_evq, &c->c_ev);
+ } else {
+ c->c_ev.ev_cb(&c->c_ev);
+ }
}
return NULL;