Lines Matching refs:p
66 static int winMutexHeld(sqlite3_mutex *p){ in winMutexHeld() argument
67 return p->nRef!=0 && p->owner==GetCurrentThreadId(); in winMutexHeld()
70 static int winMutexNotheld2(sqlite3_mutex *p, DWORD tid){ in winMutexNotheld2() argument
71 return p->nRef==0 || p->owner!=tid; in winMutexNotheld2()
74 static int winMutexNotheld(sqlite3_mutex *p){ in winMutexNotheld() argument
76 return winMutexNotheld2(p, tid); in winMutexNotheld()
213 sqlite3_mutex *p; in winMutexAlloc() local
218 p = sqlite3MallocZero( sizeof(*p) ); in winMutexAlloc()
219 if( p ){ in winMutexAlloc()
220 p->id = iType; in winMutexAlloc()
223 p->trace = 1; in winMutexAlloc()
227 InitializeCriticalSectionEx(&p->mutex, 0, 0); in winMutexAlloc()
229 InitializeCriticalSection(&p->mutex); in winMutexAlloc()
241 p = &winMutex_staticMutexes[iType-2]; in winMutexAlloc()
244 InterlockedCompareExchange(&p->trace, 1, 0); in winMutexAlloc()
250 assert( p==0 || p->id==iType ); in winMutexAlloc()
251 return p; in winMutexAlloc()
260 static void winMutexFree(sqlite3_mutex *p){ in winMutexFree() argument
261 assert( p ); in winMutexFree()
262 assert( p->nRef==0 && p->owner==0 ); in winMutexFree()
263 if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ){ in winMutexFree()
264 DeleteCriticalSection(&p->mutex); in winMutexFree()
265 sqlite3_free(p); in winMutexFree()
284 static void winMutexEnter(sqlite3_mutex *p){ in winMutexEnter() argument
289 assert( p ); in winMutexEnter()
290 assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) ); in winMutexEnter()
292 assert( p ); in winMutexEnter()
295 EnterCriticalSection(&p->mutex); in winMutexEnter()
297 assert( p->nRef>0 || p->owner==0 ); in winMutexEnter()
298 p->owner = tid; in winMutexEnter()
299 p->nRef++; in winMutexEnter()
300 if( p->trace ){ in winMutexEnter()
302 tid, p->id, p, p->trace, p->nRef)); in winMutexEnter()
307 static int winMutexTry(sqlite3_mutex *p){ in winMutexTry() argument
312 assert( p ); in winMutexTry()
313 assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) ); in winMutexTry()
332 if( winMutex_isNt && TryEnterCriticalSection(&p->mutex) ){ in winMutexTry()
334 p->owner = tid; in winMutexTry()
335 p->nRef++; in winMutexTry()
340 UNUSED_PARAMETER(p); in winMutexTry()
343 if( p->trace ){ in winMutexTry()
345 tid, p->id, p, p->trace, p->owner, p->nRef, sqlite3ErrName(rc))); in winMutexTry()
357 static void winMutexLeave(sqlite3_mutex *p){ in winMutexLeave() argument
361 assert( p ); in winMutexLeave()
363 assert( p->nRef>0 ); in winMutexLeave()
364 assert( p->owner==tid ); in winMutexLeave()
365 p->nRef--; in winMutexLeave()
366 if( p->nRef==0 ) p->owner = 0; in winMutexLeave()
367 assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE ); in winMutexLeave()
370 LeaveCriticalSection(&p->mutex); in winMutexLeave()
372 if( p->trace ){ in winMutexLeave()
374 tid, p->id, p, p->trace, p->nRef)); in winMutexLeave()