aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2023-08-10 17:07:34 +0000
committerdan <Dan Kennedy>2023-08-10 17:07:34 +0000
commit6de6121e36e33d214c5f19e9197f7cee0fb60d7f (patch)
tree165e77da459e2813194b6b46c96be7d2e47f62c3 /src/os_unix.c
parent9a897cb0dea3fe2aa17e2b1d1155fe016447fa76 (diff)
parent80c438613a687d41ce820f113a2b20e1aade93a6 (diff)
downloadsqlite-6de6121e36e33d214c5f19e9197f7cee0fb60d7f.tar.gz
sqlite-6de6121e36e33d214c5f19e9197f7cee0fb60d7f.zip
Merge latest trunk changes into this branch.
FossilOrigin-Name: 3ed89c344fcb3b7ee8b764d95144643e42e053e1116150d6eda8355fbd6669df
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index aed4ac213..59f67d142 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -6715,12 +6715,17 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
** than the argument.
*/
static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){
-#if OS_VXWORKS || _POSIX_C_SOURCE >= 199309L
+#if !defined(HAVE_NANOSLEEP) || HAVE_NANOSLEEP+0
struct timespec sp;
-
sp.tv_sec = microseconds / 1000000;
sp.tv_nsec = (microseconds % 1000000) * 1000;
+
+ /* Almost all modern unix systems support nanosleep(). But if you are
+ ** compiling for one of the rare exceptions, you can use
+ ** -DHAVE_NANOSLEEP=0 (perhaps in conjuction with -DHAVE_USLEEP if
+ ** usleep() is available) in order to bypass the use of nanosleep() */
nanosleep(&sp, NULL);
+
UNUSED_PARAMETER(NotUsed);
return microseconds;
#elif defined(HAVE_USLEEP) && HAVE_USLEEP