1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Defer creation of the sleep event object until it is needed. Added sqlite3_win32_write_debug and sqlite3_win32_sleep APIs to assist in portability to WinRT.

FossilOrigin-Name: 7af88ad306612dd316827c506dbf8df7477b2ec1
This commit is contained in:
mistachkin
2012-03-13 03:35:07 +00:00
parent 5cfbeac070
commit f4f327ce07
4 changed files with 103 additions and 36 deletions

View File

@@ -109,6 +109,8 @@ static int winMutex_isInit = 0;
*/
static long winMutex_lock = 0;
extern void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */
static int winMutexInit(void){
/* The first to increment to 1 does actual initialization */
if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
@@ -124,11 +126,7 @@ static int winMutexInit(void){
}else{
/* Someone else is in the process of initing the static mutexes */
while( !winMutex_isInit ){
#if SQLITE_OS_WINRT
Yield(); /* NOP */
#else
Sleep(1);
#endif
sqlite3_win32_sleep(1);
}
}
return SQLITE_OK;