-C Fix\sa\stsan\serror\sthat\scould\soccur\swhen\susing\sshared-cache\smode.
-D 2020-09-16T16:45:35.491
+C Do\snot\sinvoke\susleep()\sfor\smore\sthan\s999999\smicroseconds.
+D 2020-09-16T16:48:13.112
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
-F src/os_unix.c 7a306a01c32928171526ca6d5e2d2fc5e39af2f12acbae43365d9521c761be2d
+F src/os_unix.c 89f19aec76a049b4deb5f1fc16afd4786bd1d151d20467abc6570c822abbfb35
F src/os_win.c a2149ff0a85c1c3f9cc102a46c673ce87e992396ba3411bfb53db66813b32f1d
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3700a1c55427a3d4168ad1f1b8a8b0cb9ace1d107e4506e30a8f1e66d8a1195e
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 233e884d7da6601486c7b93aedb97fd29302ae5c03742d0e0eccb4790638bb77
-F src/shell.c.in b9b819feede7b85585ab0826490a352e04e2ee46e8132c92597d29972b2be1d7
+F src/shell.c.in 651e844efde4bb1b6a0d43502b6ee7ef0e5e229b52b4f1e47ef11e08d1442fc9
F src/sqlite.h.in d2c03414a8ee5d4a6855c04dd7cd5998e45139b0fe66b65bae86d4223edd091f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 2d1af80082edffd71c6f96f70ad1ce6a4fb46615ad10291fc77fe0dea9ff0197
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 553e20c3d7dcd35077d758987c411806c4574b0f8b8a1fbd63d3321dd076a0b0
-Q +de80bc87300257cc49d98e2d22e914211f213dce912f320c8b37b3883c73923c
-R 286669a37fca71d0e175626276bb973d
+P 61981b97475a747dc04e6fb80e01e35e41e5d7d30a1207f82b2ef7be3866d30a
+Q +1f5ed852f25515bbc0a7aaf236fdef40fa7e31805eee1249277fde4e68f95130
+R 095902dfcb3c2a4da5e5a0b4967cfc40
U dan
-Z 60bbc2c4ca2feb1b2bbc49267c238176
+Z c14daca6c0f63cba8ca3beff44ac028f
-61981b97475a747dc04e6fb80e01e35e41e5d7d30a1207f82b2ef7be3866d30a
\ No newline at end of file
+1f0055d0a2b36f9bd27d9d47a45a01be2644fc3be53d7c598fa8e112dd13e12b
\ No newline at end of file
return rc;
}
+/* Forward declaration*/
+static int unixSleep(sqlite3_vfs*,int);
+
/*
** Set a posix-advisory-lock.
**
** generic posix, however, there is no such API. So we simply try the
** lock once every millisecond until either the timeout expires, or until
** the lock is obtained. */
- usleep(1000);
+ unixSleep(0,1000);
rc = osFcntl(h,F_SETLK,pLock);
tm--;
}
UNUSED_PARAMETER(NotUsed);
return microseconds;
#elif defined(HAVE_USLEEP) && HAVE_USLEEP
- usleep(microseconds);
+ if( microseconds>=1000000 ) sleep(microseconds/1000000);
+ if( microseconds%1000000 ) usleep(microseconds%1000000);
UNUSED_PARAMETER(NotUsed);
return microseconds;
#else
if( nTries==1 ){
conchModTime = buf.st_mtimespec;
- usleep(500000); /* wait 0.5 sec and try the lock again*/
+ unixSleep(0,500000); /* wait 0.5 sec and try the lock again*/
continue;
}
/* don't break the lock on short read or a version mismatch */
return SQLITE_BUSY;
}
- usleep(10000000); /* wait 10 sec and try the lock again */
+ unixSleep(0,10000000); /* wait 10 sec and try the lock again */
continue;
}
}
}
+/*
+** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
+*/
+static void shellUSleepFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ int sleep = sqlite3_value_int(argv[0]);
+ sqlite3_sleep(sleep/1000);
+ sqlite3_result_int(context, sleep);
+}
+
/*
** Scalar function "shell_escape_crnl" used by the .recover command.
** The argument passed to this function is the output of built-in
shellInt32, 0, 0);
sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
shellIdQuote, 0, 0);
+ sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
+ shellUSleepFunc, 0, 0);
#ifndef SQLITE_NOHAVE_SYSTEM
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
editFunc, 0, 0);