mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
Adds new OS internal functions nxsig_sleep() and nxsig_usleep. These differ from the standard sleep() and usleep() in that (1) they don't cause cancellation points, and (2) don't set the errno variable (if applicable). All calls to sleep() and usleep() changed to calls to nxsig_sleep() and nxsig_usleep().
Squashed commit of the following:
Change all calls to usleep() in the OS proper to calls to nxsig_usleep()
sched/signal: Add a new OS internal function nxsig_usleep() that is functionally equivalent to usleep() but does not cause a cancellaption point and does not modify the errno variable.
sched/signal: Add a new OS internal function nxsig_sleep() that is functionally equivalent to sleep() but does not cause a cancellaption point.
This commit is contained in:
@@ -43,11 +43,12 @@
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/random.h>
|
||||
|
||||
#include <nuttx/sensors/hc_sr04.h>
|
||||
|
||||
/****************************************************************************
|
||||
@@ -144,7 +145,7 @@ static int hcsr04_start_measuring(FAR struct hcsr04_dev_s *priv)
|
||||
/* Send to 10uS trigger pulse */
|
||||
|
||||
priv->config->set_trigger(priv->config, true);
|
||||
usleep(10);
|
||||
nxsig_usleep(10);
|
||||
priv->config->set_trigger(priv->config, false);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user