Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Bug fixes in the mutex header file. Tickets #2599 and #2600. (CVS 4335) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4bdfe1419c536fec5b3c0a7fbe3d0ff5 |
User & Date: | drh 2007-08-30 14:10:30.000 |
Context
2007-08-30
| ||
14:41 | Fixes to malloc3.test so that it can run in transient or persistent failure mode. (CVS 4336) (check-in: e14e3688eb user: danielk1977 tags: trunk) | |
14:10 | Bug fixes in the mutex header file. Tickets #2599 and #2600. (CVS 4335) (check-in: 4bdfe1419c user: drh tags: trunk) | |
11:48 | Fixes for failures in fuzz_malloc.test. (CVS 4334) (check-in: d3e5022638 user: danielk1977 tags: trunk) | |
Changes
Changes to src/mutex.h.
︙ | ︙ | |||
15 16 17 18 19 20 21 | ** to all source files. We break it out in an effort to keep the code ** better organized. ** ** NOTE: source files should *not* #include this header file directly. ** Source files should #include the sqliteInt.h file and let that file ** include this one indirectly. ** | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ** to all source files. We break it out in an effort to keep the code ** better organized. ** ** NOTE: source files should *not* #include this header file directly. ** Source files should #include the sqliteInt.h file and let that file ** include this one indirectly. ** ** $Id: mutex.h,v 1.2 2007/08/30 14:10:30 drh Exp $ */ #ifdef SQLITE_MUTEX_APPDEF /* ** If SQLITE_MUTEX_APPDEF is defined, then this whole module is ** omitted and equivalent functionality must be provided by the |
︙ | ︙ | |||
40 41 42 43 44 45 46 | ** error checking to help verify that mutexes ** are being used correctly even though they ** are not needed. Used when SQLITE_DEBUG is ** defined on single-threaded builds. ** ** SQLITE_MUTEX_PTHREADS For multi-threaded applications on Unix. ** | | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ** error checking to help verify that mutexes ** are being used correctly even though they ** are not needed. Used when SQLITE_DEBUG is ** defined on single-threaded builds. ** ** SQLITE_MUTEX_PTHREADS For multi-threaded applications on Unix. ** ** SQLITE_MUTEX_W32 For multi-threaded applications on Win32. ** ** SQLITE_MUTEX_OS2 For multi-threaded applications on OS/2. */ #define SQLITE_MUTEX_NOOP 1 /* The default */ #if defined(SQLITE_DEBUG) && !SQLITE_THREADSAFE # undef SQLITE_MUTEX_NOOP # define SQLITE_MUTEX_NOOP_DEBUG #endif #if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && OS_UNIX # undef SQLITE_MUTEX_NOOP # define SQLITE_MUTEX_PTHREADS #endif #if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && OS_WIN # undef SQLITE_MUTEX_NOOP # define SQLITE_MUTEX_W32 #endif #if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && OS_OS2 # undef SQLITE_MUTEX_NOOP # define SQLITE_MUTEX_OS2 #endif #ifdef SQLITE_MUTEX_NOOP |
︙ | ︙ |
Changes to src/mutex_w32.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2007 August 14 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the C functions that implement mutexes for win32 ** | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* ** 2007 August 14 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the C functions that implement mutexes for win32 ** ** $Id: mutex_w32.c,v 1.2 2007/08/30 14:10:30 drh Exp $ */ #include "sqliteInt.h" /* ** The code in this file is only used if we are compiling multithreaded ** on a win32 system. */ #ifdef SQLITE_MUTEX_W32 /* ** Each recursive mutex is an instance of the following structure. */ struct sqlite3_mutex { CRITICAL_SECTION mutex; /* Mutex controlling the lock */ int id; /* Mutex type */ |
︙ | ︙ | |||
174 175 176 177 178 179 180 | */ int sqlite3_mutex_held(sqlite3_mutex *p){ return p==0 || (p->nRef!=0 && p->owner==GetCurrentThreadId()); } int sqlite3_mutex_notheld(sqlite3_mutex *p){ return p==0 || p->nRef==0 || p->owner!=GetCurrentThreadId(); } | | | 174 175 176 177 178 179 180 181 | */ int sqlite3_mutex_held(sqlite3_mutex *p){ return p==0 || (p->nRef!=0 && p->owner==GetCurrentThreadId()); } int sqlite3_mutex_notheld(sqlite3_mutex *p){ return p==0 || p->nRef==0 || p->owner!=GetCurrentThreadId(); } #endif /* SQLITE_MUTEX_W32 */ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
26 27 28 29 30 31 32 | ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** ** @(#) $Id: sqlite.h.in,v 1.248 2007/08/30 14:10:30 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ #include <stdarg.h> /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. |
︙ | ︙ | |||
3274 3275 3276 3277 3278 3279 3280 3281 | ** ** The SQLite source code contains multiple implementations ** of these mutex routines. An appropriate implementation ** is selected automatically at compile-time. The following ** implementations are available in the SQLite core: ** ** <ul> ** <li> SQLITE_MUTEX_PTHREAD | > | | | | | 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 | ** ** The SQLite source code contains multiple implementations ** of these mutex routines. An appropriate implementation ** is selected automatically at compile-time. The following ** implementations are available in the SQLite core: ** ** <ul> ** <li> SQLITE_MUTEX_OS2 ** <li> SQLITE_MUTEX_PTHREAD ** <li> SQLITE_MUTEX_W32 ** <li> SQLITE_MUTEX_NOOP ** </ul> ** ** The SQLITE_MUTEX_NOOP implementation is a set of routines ** that does no real locking and is appropriate for use in ** a single-threaded application. The SQLITE_MUTEX_OS2, ** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations ** are appropriate for use on os/2, unix, and windows. ** ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex ** implementation is included with the library. The ** mutex interface routines defined here become external ** references in the SQLite library for which implementations ** must be provided by the application. This facility allows an |
︙ | ︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.606 2007/08/30 14:10:30 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ #include "sqliteLimit.h" #define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ |
︙ | ︙ | |||
69 70 71 72 73 74 75 | # endif # define _LARGEFILE_SOURCE 1 #endif #include "sqlite3.h" #include "hash.h" #include "parse.h" | < | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # endif # define _LARGEFILE_SOURCE 1 #endif #include "sqlite3.h" #include "hash.h" #include "parse.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <stddef.h> #define sqlite3_isnan(X) ((X)!=(X)) |
︙ | ︙ | |||
291 292 293 294 295 296 297 298 299 300 301 302 303 304 | typedef struct TriggerStack TriggerStack; typedef struct TriggerStep TriggerStep; typedef struct Trigger Trigger; typedef struct WhereInfo WhereInfo; typedef struct WhereLevel WhereLevel; #include "os.h" /* ** Each database file to be accessed by the system is an instance ** of the following structure. There are normally two of these structures ** in the sqlite.aDb[] array. aDb[0] is the main database file and ** aDb[1] is the database file used to hold temporary tables. Additional ** databases may be attached. | > | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | typedef struct TriggerStack TriggerStack; typedef struct TriggerStep TriggerStep; typedef struct Trigger Trigger; typedef struct WhereInfo WhereInfo; typedef struct WhereLevel WhereLevel; #include "os.h" #include "mutex.h" /* ** Each database file to be accessed by the system is an instance ** of the following structure. There are normally two of these structures ** in the sqlite.aDb[] array. aDb[0] is the main database file and ** aDb[1] is the database file used to hold temporary tables. Additional ** databases may be attached. |
︙ | ︙ |