-C Add\srecognition\sof\sthe\sSQLITE_OS_WINRT\scompile-time\soption.\s\s\nUse\sInitializeCriticalSectionEx()\sunder\swinRT.
-D 2012-03-01T20:05:41.277
+C Use\sWaitForSingleObjectEx()\sas\sa\ssubstitute\sfor\sSleep\son\swinRT.
+D 2012-03-01T21:19:39.132
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
-F Makefile.msc 0e67f253439ebc333b7b49f373d5932a93209c6a
+F Makefile.msc 2aa54dceaafea890a19cd7f06ac7c168aff669d8
F Makefile.vxworks 1deb39c8bb047296c30161ffa10c1b5423e632f9
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION bb4c2a86abe53ea3c1d6ea515b69a426040e2414
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
F src/os_unix.c 0e3d2942d228d0366fb80a3640f35caf413b66d1
-F src/os_win.c 5ac061ae1326a71500cee578ed0fd9113b4f6a37
+F src/os_win.c b9c36459cf8f37d16a24f35cca934c21d74f0e5b
F src/pager.c 3955b62cdb5bb64559607cb474dd12a6c8e1d4a5
F src/pager.h ef1eaf8593e78f73885c1dfac27ad83bee23bdc5
F src/parse.y 1ddd71ae55f4b7cbb2672526ea4de023de0f519e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 718905367ff3f86a449c2c27f724089ba31dea3a
-R 465a0789e63e9500d164032936751907
+P 8b7ca8a09f7b69db1fe766616cba0307e681a6f3
+R 8f274d295cc98eee7dadf7a129e9b0df
U drh
-Z 36d2e47a7d135f112024e54b1ccd201a
+Z a00ee944783dbe7653fdca656eaa2c07
static int sqlite3_os_type = 0;
#endif
-/*
-** Many system calls are accessed through pointer-to-functions so that
-** they may be overridden at runtime to facilitate fault injection during
-** testing and sandboxing. The following array holds the names and pointers
-** to all overrideable system calls.
-*/
-#if !SQLITE_OS_WINCE
+#if !SQLITE_OS_WINCE || SQLITE_OS_WINRT
# define SQLITE_WIN32_HAS_ANSI
#endif
-#if SQLITE_OS_WINCE || SQLITE_OS_WINNT
+#if SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT
# define SQLITE_WIN32_HAS_WIDE
#endif
# define osLockFileEx LockFileEx
#endif
+/*
+** Many system calls are accessed through pointer-to-functions so that
+** they may be overridden at runtime to facilitate fault injection during
+** testing and sandboxing. The following array holds the names and pointers
+** to all overrideable system calls.
+*/
static struct win_syscall {
const char *zName; /* Name of the sytem call */
sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
DWORD))aSyscall[52].pCurrent)
+#if SQLITE_OS_WINRT
+ { "Sleep", (SYSCALL)0, 0 },
+#else
{ "Sleep", (SYSCALL)Sleep, 0 },
+#endif
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[53].pCurrent)
return 0;
}
+/*
+** The following routine Suspends the thread for at least ms milliseconds. This is equivalent
+** to the win32 Sleep() interface.
+*/
+#if SQLITE_OS_WINRT
+static HANDLE sleepObj;
+static void portableSleep(int ms){
+ WaitForSingleObjectEx(sleepObj, ms, FALSE);
+}
+#else
+static void portableSleep(int ms){
+ osSleep(ms);
+}
+#endif
+
/*
** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,
** or WinCE. Return false (zero) for Win95, Win98, or WinME.
** WinNT/2K/XP so that we will know whether or not we can safely call
** the LockFileEx() API.
*/
-#if SQLITE_OS_WINCE
+#if SQLITE_OS_WINCE || SQLITE_OS_WINRT
# define isNT() (1)
#else
static int isNT(void){
if( e==ERROR_ACCESS_DENIED ||
e==ERROR_LOCK_VIOLATION ||
e==ERROR_SHARING_VIOLATION ){
- osSleep(win32IoerrRetryDelay*(1+*pnRetry));
+ portableSleep(win32IoerrRetryDelay*(1+*pnRetry));
++*pnRetry;
return 1;
}
do{
rc = osCloseHandle(pFile->h);
/* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */
- }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (osSleep(100), 1) );
+ }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (portableSleep(100), 1) );
#if SQLITE_OS_WINCE
#define WINCE_DELETION_ATTEMPTS 3
winceDestroyLock(pFile);
&& osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff
&& cnt++ < WINCE_DELETION_ATTEMPTS
){
- osSleep(100); /* Wait a little before trying again */
+ portableSleep(100); /* Wait a little before trying again */
}
sqlite3_free(pFile->zDeleteOnClose);
}
** copy this retry logic. It is a hack intended for Windows only.
*/
OSTRACE(("could not get a PENDING lock. cnt=%d\n", cnt));
- if( cnt ) osSleep(1);
+ if( cnt ) portableSleep(1);
}
gotPendingLock = res;
if( !res ){
** Sleep for a little while. Return the amount of time slept.
*/
static int winSleep(sqlite3_vfs *pVfs, int microsec){
- osSleep((microsec+999)/1000);
+ portableSleep((microsec+999)/1000);
UNUSED_PARAMETER(pVfs);
return ((microsec+999)/1000)*1000;
}
** correctly. See ticket [bb3a86e890c8e96ab] */
assert( ArraySize(aSyscall)==60 );
+#if SQLITE_OS_WINRT
+ sleepObj = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
+ EVENT_ALL_ACCESS);
+#endif
+
#ifndef SQLITE_OMIT_WAL
/* get memory map allocation granularity */
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
}
int sqlite3_os_end(void){
+#if SQLITE_OS_WINRT
+ CloseHandle(sleepObj);
+#endif
return SQLITE_OK;
}