Create a fresh pthread_mutexattr_t every time a recursive mutex is
allocated. Ticket #2588. (CVS 4300) FossilOrigin-Name: 3d746343add3feb9d208302a00b419d71d6ba246
This commit is contained in:
parent
8bacf9743f
commit
4b6b4ab0d2
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Documentation\sand\scomment\supdates\sin\ssqlite.h.in\sand\smutex.c.\s(CVS\s4299)
|
||||
D 2007-08-25T16:21:30
|
||||
C Create\sa\sfresh\spthread_mutexattr_t\severy\stime\sa\srecursive\smutex\sis\nallocated.\s\sTicket\s#2588.\s(CVS\s4300)
|
||||
D 2007-08-25T16:31:30
|
||||
F Makefile.in 938f2769921fa1b30c633548f153804021eb1512
|
||||
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -103,7 +103,7 @@ F src/malloc.c d4282f50964ab1ca31f504c97b7cf2fdb4d4195d
|
||||
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
|
||||
F src/mem1.c afe2fbf6d7e8247c6c9f69c1481358b1cad60c08
|
||||
F src/mem2.c 1a2ca756a285b5365d667841508cc1f98938b8d8
|
||||
F src/mutex.c 676c77a92127d27862d880f7789805f753737f00
|
||||
F src/mutex.c 438d59f4ea7a69d8607c024702d3a137ee55bc5e
|
||||
F src/os.c a8ed3c495161475dbce255f7003144144fb425f1
|
||||
F src/os.h 2bfbbad126a775e4d8c7d59eb4d9585a5fd7dfb5
|
||||
F src/os_common.h a5c446d3b93f09f369d13bf217de4bed3437dd1c
|
||||
@ -561,7 +561,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P a6bbf6eaf6ccc471b4efe02cd8a3971112d909ab
|
||||
R 5aa8de70c5a923723a89fce8d25cd561
|
||||
P 7289079d6b4a7a160063e34c0f5e43637ef7476f
|
||||
R d800e16d6642cfcaec4398d15460213b
|
||||
U drh
|
||||
Z dd6162fabca2e02bb42b3381cc2f1528
|
||||
Z 01a98a984e78c80696ffafb95f213436
|
||||
|
@ -1 +1 @@
|
||||
7289079d6b4a7a160063e34c0f5e43637ef7476f
|
||||
3d746343add3feb9d208302a00b419d71d6ba246
|
20
src/mutex.c
20
src/mutex.c
@ -12,7 +12,7 @@
|
||||
** This file contains the C functions that implement mutexes for
|
||||
** use by the SQLite core.
|
||||
**
|
||||
** $Id: mutex.c,v 1.12 2007/08/25 16:21:30 drh Exp $
|
||||
** $Id: mutex.c,v 1.13 2007/08/25 16:31:30 drh Exp $
|
||||
*/
|
||||
/*
|
||||
** If SQLITE_MUTEX_APPDEF is defined, then this whole module is
|
||||
@ -289,22 +289,14 @@ sqlite3_mutex *sqlite3_mutex_alloc(int iType){
|
||||
sqlite3_mutex *p;
|
||||
switch( iType ){
|
||||
case SQLITE_MUTEX_RECURSIVE: {
|
||||
static pthread_mutex_t initMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int isInit = 0;
|
||||
static pthread_mutexattr_t recursiveAttr;
|
||||
if( !isInit ){
|
||||
pthread_mutex_lock(&initMutex);
|
||||
if( !isInit ){
|
||||
pthread_mutexattr_init(&recursiveAttr);
|
||||
pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE);
|
||||
}
|
||||
isInit = 1;
|
||||
pthread_mutex_unlock(&initMutex);
|
||||
}
|
||||
p = sqlite3MallocZero( sizeof(*p) );
|
||||
if( p ){
|
||||
p->id = iType;
|
||||
pthread_mutexattr_t recursiveAttr;
|
||||
pthread_mutexattr_init(&recursiveAttr);
|
||||
pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&p->mutex, &recursiveAttr);
|
||||
pthread_mutexattr_destroy(&recursiveAttr);
|
||||
p->id = iType;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user