aboutsummaryrefslogtreecommitdiff
path: root/src/mutex_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mutex_unix.c')
-rw-r--r--src/mutex_unix.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mutex_unix.c b/src/mutex_unix.c
index a1ebc3b75..196975e71 100644
--- a/src/mutex_unix.c
+++ b/src/mutex_unix.c
@@ -235,6 +235,7 @@ static void pthreadMutexEnter(sqlite3_mutex *p){
*/
pthread_mutex_lock(&p->mutex);
#if SQLITE_MUTEX_NREF
+ assert( p->nRef>0 || p->owner==0 );
p->owner = pthread_self();
p->nRef++;
#endif
@@ -307,6 +308,7 @@ static void pthreadMutexLeave(sqlite3_mutex *p){
assert( pthreadMutexHeld(p) );
#if SQLITE_MUTEX_NREF
p->nRef--;
+ if( p->nRef==0 ) p->owner = 0;
#endif
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );