Skip to content

Commit

Permalink
lib/cmsis_rtos_v1: Use k_mbox_async_put instead of k_mbox_put
Browse files Browse the repository at this point in the history
Use the asynchronous version of mbox_put instead of the
synchronous one. Also, add an error check in osMailPut.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
  • Loading branch information
rgundi authored and nashif committed Sep 11, 2018
1 parent c850ba8 commit 9fed7d6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/cmsis_rtos_v1/cmsis_mailq.c
Expand Up @@ -105,16 +105,17 @@ osStatus osMailPut(osMailQId queue_id, void *mail)
return osErrorParameter;
}

if (mail == NULL) {
return osErrorValue;
}

memset(&mmsg, 0, sizeof(mmsg));
mmsg.tx_data = mail;
mmsg.rx_source_thread = K_ANY;
mmsg.tx_target_thread = K_ANY;

if (k_mbox_put(queue_def->mbox, &mmsg, 100) == 0) {
return osOK;
} else {
return osErrorValue;
}
k_mbox_async_put(queue_def->mbox, &mmsg, NULL);
return osOK;
}

/**
Expand Down

0 comments on commit 9fed7d6

Please sign in to comment.