Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Use local variables instead of #defines for the mutex name and length in OS/2's sqlite3_mutex_alloc(). (CVS 4453) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
272959cc91d0c9299d6fca8a962eb563 |
User & Date: | pweilbacher 2007-10-02 19:56:04.000 |
Context
2007-10-03
| ||
08:46 | Add automatic recovery from the pager "error-state". Also add a new error code - SQLITE_IOERR_NOMEM. (CVS 4454) (check-in: 12eca32a6a user: danielk1977 tags: trunk) | |
2007-10-02
| ||
19:56 | Use local variables instead of #defines for the mutex name and length in OS/2's sqlite3_mutex_alloc(). (CVS 4453) (check-in: 272959cc91 user: pweilbacher tags: trunk) | |
2007-10-01
| ||
17:47 | Additional #ifdefing around _XOPEN_SOURCE. Ticket #2681. (CVS 4452) (check-in: eb5d78451e user: drh tags: trunk) | |
Changes
Changes to src/mutex_os2.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2007 August 28 ** ** 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 OS/2 ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2007 August 28 ** ** 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 OS/2 ** ** $Id: mutex_os2.c,v 1.3 2007/10/02 19:56:04 pweilbacher Exp $ */ #include "sqliteInt.h" /* ** The code in this file is only used if SQLITE_MUTEX_OS2 is defined. ** See the mutex.h file for details. */ |
︙ | ︙ | |||
74 75 76 77 78 79 80 | ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() ** returns a different mutex on every call. But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. */ sqlite3_mutex *sqlite3_mutex_alloc(int iType){ | | | | | | | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() ** returns a different mutex on every call. But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. */ sqlite3_mutex *sqlite3_mutex_alloc(int iType){ PSZ mutex_name = "\\SEM32\\SQLITE\\MUTEX"; int mutex_name_len = strlen(mutex_name) + 1; /* name length + null byte */ sqlite3_mutex *p; switch( iType ){ case SQLITE_MUTEX_FAST: case SQLITE_MUTEX_RECURSIVE: { p = sqlite3MallocZero( sizeof(*p) ); if( p ){ p->mutexName = (PSZ)malloc(mutex_name_len); sqlite3_snprintf(mutex_name_len, p->mutexName, "%s", mutex_name); p->id = iType; DosCreateMutexSem(p->mutexName, &p->mutex, 0, FALSE); DosOpenMutexSem(p->mutexName, &p->mutex); } break; } default: { static sqlite3_mutex staticMutexes[5]; static int isInit = 0; while( !isInit ) { static long lock = 0; DosEnterCritSec(); lock++; if( lock == 1 ) { DosExitCritSec(); int i; for(i = 0; i < sizeof(staticMutexes)/sizeof(staticMutexes[0]); i++) { staticMutexes[i].mutexName = (PSZ)malloc(mutex_name_len + 1); sqlite3_snprintf(mutex_name_len + 1, /* one more for the number */ staticMutexes[i].mutexName, "%s%1d", mutex_name, i); DosCreateMutexSem(staticMutexes[i].mutexName, &staticMutexes[i].mutex, 0, FALSE); DosOpenMutexSem(staticMutexes[i].mutexName, &staticMutexes[i].mutex); } isInit = 1; } else { |
︙ | ︙ |