diff options
author | drh <drh@noemail.net> | 2007-08-25 03:59:08 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-08-25 03:59:08 +0000 |
commit | dc3060fea3d533358fb9f0b276a8f9cc324384e1 (patch) | |
tree | ed3011eb61016a90bf1d6fe4f183280ffe3b0f93 /src | |
parent | bff101efd76314c192d2c3f3f050beb0dff69933 (diff) | |
download | sqlite-dc3060fea3d533358fb9f0b276a8f9cc324384e1.tar.gz sqlite-dc3060fea3d533358fb9f0b276a8f9cc324384e1.zip |
Bug fix in the implementation of recursive mutexes using non-recursive
pthreads mutexes. Ticket #2588. (CVS 4292)
FossilOrigin-Name: 7d24c3a5a7641df2bbb8c91a0bc5aa75c96a73fe
Diffstat (limited to 'src')
-rw-r--r-- | src/mutex.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mutex.c b/src/mutex.c index 38caf94fb..7bf66949b 100644 --- a/src/mutex.c +++ b/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.9 2007/08/24 20:46:59 drh Exp $ +** $Id: mutex.c,v 1.10 2007/08/25 03:59:09 drh Exp $ */ /* ** If SQLITE_MUTEX_APPDEF is defined, then this whole module is @@ -321,7 +321,7 @@ void sqlite3_mutex_free(sqlite3_mutex *p){ */ void sqlite3_mutex_enter(sqlite3_mutex *p){ pthread_t self = pthread_self(); - if( pthread_equal(p->owner, self) && p->nRef>0 ){ + if( p->nRef>0 && pthread_equal(p->owner, self) ){ p->nRef++; }else{ pthread_mutex_lock(&p->mutex); @@ -333,7 +333,7 @@ void sqlite3_mutex_enter(sqlite3_mutex *p){ int sqlite3_mutex_try(sqlite3_mutex *p){ pthread_t self = pthread_self(); int rc; - if( pthread_equal(p->owner, self) && p->nRef>0 ){ + if( p->nRef>0 && pthread_equal(p->owner, self) ){ p->nRef++; rc = SQLITE_OK; }else if( pthread_mutex_lock(&p->mutex)==0 ){ |