Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove the obsolete static mutexes. Use only the lastest static mutex code. (CVS 4259) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6225cd461cdd2132eeb480aa4deb8986 |
User & Date: | drh 2007-08-21 13:51:23.000 |
Context
2007-08-21
| ||
14:27 | Delay opening temporary pager files until they are first written. (CVS 4260) (check-in: 3fb97a63ef user: danielk1977 tags: trunk) | |
13:51 | Remove the obsolete static mutexes. Use only the lastest static mutex code. (CVS 4259) (check-in: 6225cd461c user: drh tags: trunk) | |
13:30 | Add the tests that go with the previous commit. (CVS 4258) (check-in: a87f32e13e user: danielk1977 tags: trunk) | |
Changes
Changes to src/loadext.c.
︙ | ︙ | |||
368 369 370 371 372 373 374 | /* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ int sqlite3_auto_extension(void *xInit){ int i; int rc = SQLITE_OK; | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | /* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */ int sqlite3_auto_extension(void *xInit){ int i; int rc = SQLITE_OK; sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); sqlite3_mutex_enter(mutex); for(i=0; i<nAutoExtension; i++){ if( aAutoExtension[i]==xInit ) break; } if( i==nAutoExtension ){ int nByte = (++nAutoExtension)*sizeof(aAutoExtension[0]); aAutoExtension = sqlite3_realloc(aAutoExtension, nByte); |
︙ | ︙ | |||
392 393 394 395 396 397 398 | return rc; } /* ** Reset the automatic extension loading mechanism. */ void sqlite3_reset_auto_extension(void){ | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | return rc; } /* ** Reset the automatic extension loading mechanism. */ void sqlite3_reset_auto_extension(void){ sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); sqlite3_mutex_enter(mutex); sqlite3_free(aAutoExtension); aAutoExtension = 0; nAutoExtension = 0; sqlite3_mutex_leave(mutex); } |
︙ | ︙ | |||
415 416 417 418 419 420 421 | if( nAutoExtension==0 ){ /* Common case: early out without every having to acquire a mutex */ return SQLITE_OK; } for(i=0; go; i++){ char *zErrmsg = 0; | | | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | if( nAutoExtension==0 ){ /* Common case: early out without every having to acquire a mutex */ return SQLITE_OK; } for(i=0; go; i++){ char *zErrmsg = 0; sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); sqlite3_mutex_enter(mutex); if( i>=nAutoExtension ){ xInit = 0; go = 0; }else{ xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) aAutoExtension[i]; |
︙ | ︙ |
Changes to src/os_unix.c.
︙ | ︙ | |||
369 370 371 372 373 374 375 | } sqlite3LockingStyle; #endif /* SQLITE_ENABLE_LOCKING_STYLE */ /* ** Helper functions to obtain and relinquish the global mutex. */ static void enterMutex(){ | | | | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | } sqlite3LockingStyle; #endif /* SQLITE_ENABLE_LOCKING_STYLE */ /* ** Helper functions to obtain and relinquish the global mutex. */ static void enterMutex(){ sqlite3_mutex_enter(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); } static void leaveMutex(){ sqlite3_mutex_leave(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER)); } #if SQLITE_THREADSAFE /* ** This variable records whether or not threads can override each others ** locks. ** |
︙ | ︙ |
Changes to src/random.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ************************************************************************* ** This file contains code to implement a pseudo-random number ** generator (PRNG) for SQLite. ** ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. ** | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ************************************************************************* ** This file contains code to implement a pseudo-random number ** generator (PRNG) for SQLite. ** ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. ** ** $Id: random.c,v 1.20 2007/08/21 13:51:23 drh Exp $ */ #include "sqliteInt.h" /* ** Get a single 8-bit random value from the RC4 PRNG. The Mutex ** must be held while executing this routine. |
︙ | ︙ | |||
87 88 89 90 91 92 93 | } /* ** Return N random bytes. */ void sqlite3Randomness(int N, void *pBuf){ unsigned char *zBuf = pBuf; | > > > > | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | } /* ** Return N random bytes. */ void sqlite3Randomness(int N, void *pBuf){ unsigned char *zBuf = pBuf; static sqlite3_mutex *mutex = 0; if( mutex==0 ){ mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_PRNG); } sqlite3_mutex_enter(mutex); while( N-- ){ *(zBuf++) = randomByte(); } sqlite3_mutex_leave(mutex); } |
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.594 2007/08/21 13:51:23 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ #include "sqliteLimit.h" #if defined(SQLITE_TCL) || defined(TCLSH) |
︙ | ︙ | |||
189 190 191 192 193 194 195 | typedef sqlite_uint64 u64; /* 8-byte unsigned integer */ typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef UINT8_TYPE i8; /* 1-byte signed integer */ | < < < < < < < < < < | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | typedef sqlite_uint64 u64; /* 8-byte unsigned integer */ typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ typedef UINT8_TYPE i8; /* 1-byte signed integer */ /* ** Macros to determine whether the machine is big or little endian, ** evaluated at runtime. */ extern const int sqlite3one; #if defined(i386) || defined(__i386__) || defined(_M_IX86) # define SQLITE_BIGENDIAN 0 |
︙ | ︙ |