Improvements to the TRACE macro in test_async.c. (CVS 3088)
FossilOrigin-Name: 4c6dfec54fc128644e066c04902433f8df30672e
This commit is contained in:
parent
4b74b26052
commit
fc8748a772
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C I/O\serrors\sshut\sdown\sall\sprocessing\son\sthe\ssame\sfile\sin\stest_async.c.\s(CVS\s3087)
|
||||
D 2006-02-13T13:50:56
|
||||
C Improvements\sto\sthe\sTRACE\smacro\sin\stest_async.c.\s(CVS\s3088)
|
||||
D 2006-02-13T14:49:39
|
||||
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
|
||||
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -80,7 +80,7 @@ F src/test4.c ff4e9406b3d2809966d8f0e82468ac5508be9f56
|
||||
F src/test5.c 7162f8526affb771c4ed256826eee7bb9eca265f
|
||||
F src/test6.c 60a02961ceb7b3edc25f5dc5c1ac2556622a76de
|
||||
F src/test7.c d28d3e62f9594923648fc6a8fb030eba36564ba1
|
||||
F src/test_async.c 3788835109389314abd9281b42bdb3a39e626016
|
||||
F src/test_async.c 54636b981b4fd713fc43431643533ebda01c3549
|
||||
F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
||||
F src/test_server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||
F src/tokenize.c 382b3bb0ca26eb9153b5d20b246ef512a114a24f
|
||||
@ -352,7 +352,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P ad25127b067b3135694ddb0de552aad981640669
|
||||
R c172fd59b56c5fed4fe5f809faeffff3
|
||||
P 4366e7121703a18ebb799dfa4f168b3b2508604e
|
||||
R 452100386a2d4ef89296f723a0e64f5d
|
||||
U drh
|
||||
Z 077affc5334060506b2ff1fb3322bebe
|
||||
Z 9b2e039e9fbfb0544c06b3d486f0c601
|
||||
|
@ -1 +1 @@
|
||||
4366e7121703a18ebb799dfa4f168b3b2508604e
|
||||
4c6dfec54fc128644e066c04902433f8df30672e
|
@ -106,11 +106,18 @@ typedef struct AsyncFile AsyncFile;
|
||||
|
||||
/* Enable for debugging */
|
||||
#if 0
|
||||
# define TRACE(X,Y) \
|
||||
fprintf(stderr,"THRD=%d: ", (int)pthread_self()); \
|
||||
fprintf(stderr,X,Y);
|
||||
# define TRACE(X) asyncTrace X
|
||||
static void asyncTrace(const char *zFormat, ...){
|
||||
char *z;
|
||||
va_list ap;
|
||||
va_start(ap, zFormat);
|
||||
z = sqlite3_vmprintf(zFormat, ap);
|
||||
va_end(ap);
|
||||
fprintf(stderr, "[%d] %s", (int)pthread_self(), z);
|
||||
free(z);
|
||||
}
|
||||
#else
|
||||
# define TRACE(X,Y) /* noop */
|
||||
# define TRACE(X) /* noop */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -315,7 +322,8 @@ struct AsyncWrite {
|
||||
*/
|
||||
struct AsyncFile {
|
||||
IoMethod *pMethod; /* Must be first */
|
||||
int ioError; /* Value of any asychronous error we have seen */ i64 iOffset; /* Current seek() offset in file */
|
||||
int ioError; /* Value of any asychronous error we have seen */
|
||||
i64 iOffset; /* Current seek() offset in file */
|
||||
OsFile *pBaseRead; /* Read handle to the underlying Os file */
|
||||
OsFile *pBaseWrite; /* Write handle to the underlying Os file */
|
||||
};
|
||||
@ -343,7 +351,7 @@ static void addAsyncWrite(AsyncWrite *pWrite){
|
||||
async.pQueueFirst = pWrite;
|
||||
}
|
||||
async.pQueueLast = pWrite;
|
||||
TRACE("PUSH %p\n", pWrite);
|
||||
TRACE(("PUSH %p\n", pWrite));
|
||||
|
||||
/* Drop the queue mutex */
|
||||
pthread_mutex_unlock(&async.queueMutex);
|
||||
@ -828,13 +836,13 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
pthread_mutex_unlock(&async.queueMutex);
|
||||
break;
|
||||
}else{
|
||||
TRACE("IDLE\n", 0);
|
||||
TRACE(("IDLE\n"));
|
||||
pthread_cond_wait(&async.queueSignal, &async.queueMutex);
|
||||
TRACE("WAKEUP\n", 0);
|
||||
TRACE(("WAKEUP\n"));
|
||||
}
|
||||
}
|
||||
if( p==0 ) break;
|
||||
TRACE("PROCESSING %p\n", p);
|
||||
TRACE(("PROCESSING %p\n", p));
|
||||
|
||||
/* Right now this thread is holding the mutex on the write-op queue.
|
||||
** Variable 'p' points to the first entry in the write-op queue. In
|
||||
@ -957,7 +965,7 @@ static void *asyncWriterThread(void *NotUsed){
|
||||
pthread_mutex_lock(&async.queueMutex);
|
||||
holdingMutex = 1;
|
||||
}
|
||||
TRACE("UNLINK %p\n", p);
|
||||
TRACE(("UNLINK %p\n", p));
|
||||
if( p==async.pQueueLast ){
|
||||
async.pQueueLast = 0;
|
||||
}
|
||||
@ -1116,7 +1124,7 @@ static int testAsyncWait(
|
||||
Tcl_AppendResult(interp, "would block forever", (char*)0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
TRACE("WAIT\n",0);
|
||||
TRACE(("WAIT\n"));
|
||||
pthread_cond_broadcast(&async.queueSignal);
|
||||
pthread_mutex_lock(&async.writerMutex);
|
||||
pthread_mutex_unlock(&async.writerMutex);
|
||||
|
Loading…
Reference in New Issue
Block a user