SQLite

Check-in [8b7ca8a09f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add recognition of the SQLITE_OS_WINRT compile-time option. Use InitializeCriticalSectionEx() under winRT.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | winrt
Files: files | file ages | folders
SHA1: 8b7ca8a09f7b69db1fe766616cba0307e681a6f3
User & Date: drh 2012-03-01 20:05:41.277
Context
2012-03-01
21:19
Use WaitForSingleObjectEx() as a substitute for Sleep on winRT. (check-in: bf897be0da user: drh tags: winrt)
20:05
Add recognition of the SQLITE_OS_WINRT compile-time option. Use InitializeCriticalSectionEx() under winRT. (check-in: 8b7ca8a09f user: drh tags: winrt)
19:14
Add back in some #includes that were removed incorrectly by the previous check-in. (check-in: 718905367f user: drh tags: winrt)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.msc.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
BCC = cl.exe

# C Compile and options for use in building executables that
# will run on the target platform.  (BCC and TCC are usually the
# same unless your are cross-compiling.)
#
TCC = cl.exe -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise

# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in 
# any extension header files by default.  For non-amalgamation
# builds, we need to make sure the compiler can find these.
#
!IF $(USE_AMALGAMATION)==0
TCC = $(TCC) -I$(TOP)\ext\fts3







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
BCC = cl.exe

# C Compile and options for use in building executables that
# will run on the target platform.  (BCC and TCC are usually the
# same unless your are cross-compiling.)
#
TCC = cl.exe -W3 -DSQLITE_OS_WIN=1 -DSQLITE_OS_WINRT=1 -I. -I$(TOP)\src -fp:precise

# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in 
# any extension header files by default.  For non-amalgamation
# builds, we need to make sure the compiler can find these.
#
!IF $(USE_AMALGAMATION)==0
TCC = $(TCC) -I$(TOP)\ext\fts3
Changes to src/mutex_w32.c.
110
111
112
113
114
115
116



117

118
119
120
121
122
123
124
static long winMutex_lock = 0;

static int winMutexInit(void){ 
  /* The first to increment to 1 does actual initialization */
  if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
    int i;
    for(i=0; i<ArraySize(winMutex_staticMutexes); i++){



      InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);

    }
    winMutex_isInit = 1;
  }else{
    /* Someone else is in the process of initing the static mutexes */
    while( !winMutex_isInit ){
      Sleep(1);
    }







>
>
>

>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
static long winMutex_lock = 0;

static int winMutexInit(void){ 
  /* The first to increment to 1 does actual initialization */
  if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
    int i;
    for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
#if SQLITE_OS_WINRT
      InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0);
#else
      InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
#endif
    }
    winMutex_isInit = 1;
  }else{
    /* Someone else is in the process of initing the static mutexes */
    while( !winMutex_isInit ){
      Sleep(1);
    }
Changes to src/os.h.
111
112
113
114
115
116
117








118
119
120
121
122
123
124
*/
#if defined(_WIN32_WCE)
# define SQLITE_OS_WINCE 1
#else
# define SQLITE_OS_WINCE 0
#endif









/* If the SET_FULLSYNC macro is not defined above, then make it
** a no-op
*/
#ifndef SET_FULLSYNC
# define SET_FULLSYNC(x,y)
#endif








>
>
>
>
>
>
>
>







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
*/
#if defined(_WIN32_WCE)
# define SQLITE_OS_WINCE 1
#else
# define SQLITE_OS_WINCE 0
#endif

/*
** Determine if we are dealing with WindowsRT (Metro) as this has a different and
** incompatible API from win32.
*/
#if !defined(SQLITE_OS_WINRT)
# define SQLITE_OS_WINRT 0
#endif

/* If the SET_FULLSYNC macro is not defined above, then make it
** a no-op
*/
#ifndef SET_FULLSYNC
# define SET_FULLSYNC(x,y)
#endif