-C Performance\senhancement:\savoid\scalling\sreparentChildPages()\sfrom\sbalance_nonroot().\s(CVS\s5743)
-D 2008-09-26T17:31:55
+C Make\ssure\sthe\squeueMutex\sis\sheld\sprior\sto\swriting\sthe\spQueueLast\sfield\nof\sthe\swrite\squeue\sin\sthe\sasync\sdemonstration\scode.\s\sTicket\s#3405.\s(CVS\s5744)
+D 2008-09-26T20:02:50
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in e4ab842f9a64ef61d57093539a8aab76b12810db
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/test7.c 475b1fa7e3275408b40a3cbdc9508cbdc41ffa02
F src/test8.c 3637439424d0d21ff2dcf9b015c30fcc1e7bcb24
F src/test9.c 904ebe0ed1472d6bad17a81e2ecbfc20017dc237
-F src/test_async.c de6661370d96f660e0f0d604582c193c6144b19c
+F src/test_async.c 45024094ed7cf780c5d5dccda645145f95cf78ef
F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad
F src/test_btree.c 8d5b835054f1dd15992e09864a8bc04386bab701
F src/test_config.c db72e95bafdd53c05ceb8735f833cc5dc1f48782
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 5debf12fa46520946ac5da44c03448fffbc9940c
-R ad8baa95733fbb9a312a15654e608ce1
-U danielk1977
-Z 410e2e4a76b6dc0451fd1f6a24aebc75
+P 28fd0a50ca8529892f5b1ababd38d494889eed6d
+R 42f79e8d6bad8dc05f28b70884a1cf00
+U drh
+Z c1f39a8806852672a67f740f0e33cd9d
-28fd0a50ca8529892f5b1ababd38d494889eed6d
\ No newline at end of file
+5622a1e285fc4d5720f7180a0eb551952f2df331
\ No newline at end of file
**
*************************************************************************
**
-** $Id: test_async.c,v 1.47 2008/09/15 15:49:34 danielk1977 Exp $
+** $Id: test_async.c,v 1.48 2008/09/26 20:02:50 drh Exp $
**
** This file contains an example implementation of an asynchronous IO
** backend for SQLite.
return rc;
}
+/*
+** Assert that the mutex is held by the current thread.
+*/
+static void assert_mutex_is_held(pthread_mutex_t *pMutex){
+ int iIdx;
+ pthread_mutex_t *aMutex = (pthread_mutex_t *)(&async);
+ pthread_t *aHolder = (pthread_t *)(&asyncdebug);
+
+ for(iIdx=0; iIdx<3; iIdx++){
+ if( pMutex==&aMutex[iIdx] ) break;
+ }
+ assert(iIdx<3);
+ assert( aHolder[iIdx]==pthread_self() );
+}
+
/* Call our async_XX wrappers instead of selected pthread_XX functions */
#define pthread_mutex_lock async_mutex_lock
#define pthread_mutex_unlock async_mutex_unlock
#define pthread_mutex_trylock async_mutex_trylock
#define pthread_cond_wait async_cond_wait
+#else /* if defined(NDEBUG) */
+
+#define assert_mutex_is_held(X) /* A no-op when not debugging */
+
#endif /* !defined(NDEBUG) */
/*
rc = unlinkAsyncFile(pData);
pthread_mutex_unlock(&async.lockMutex);
+ if( !holdingMutex ){
+ pthread_mutex_lock(&async.queueMutex);
+ holdingMutex = 1;
+ }
+ assert_mutex_is_held(&async.queueMutex);
async.pQueueFirst = p->pNext;
sqlite3_free(pData);
doNotFree = 1;
async.pQueueLast = 0;
}
if( !doNotFree ){
+ assert_mutex_is_held(&async.queueMutex);
async.pQueueFirst = p->pNext;
sqlite3_free(p);
}