Fix unreachable branches in the threads.c module.

FossilOrigin-Name: 3175e366bbf7579ec9ab27214b0a4e5cd27ea204
This commit is contained in:
drh 2014-07-29 18:46:30 +00:00
parent cd4b637760
commit b92284de11
4 changed files with 21 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sharmless\scompiler\swarning.
D 2014-07-29T17:22:12.808
C Fix\sunreachable\sbranches\sin\sthe\sthreads.c\smodule.
D 2014-07-29T18:46:30.709
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -277,7 +277,7 @@ F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb
F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c dfc566f8b5744914bb3e6fe77b5ed63037b9b35d
F src/threads.c b4152ced8515d11a2293c036109069a4e23d78a8
F src/tokenize.c ae45399d6252b4d736af43bee1576ce7bff86aec
F src/trigger.c 66f3470b03b52b395e839155786966e3e037fddb
F src/update.c 01564b3c430f6c7b0a35afaf7aba7987206fa3a5
@ -291,7 +291,7 @@ F src/vdbeapi.c 24e40422382beb774daab11fe9fe9d37e8a04949
F src/vdbeaux.c 3f1d2baa4a8cbdad33cb255a5f4fd1af7a414683
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
F src/vdbemem.c d90a1e8acf8b63dc9d14cbbea12bfec6cec31394
F src/vdbesort.c 48b99b15ac27229a67ed601a711aad1a36cc8631
F src/vdbesort.c 2198e33de4c2c32bdb3fb4f06dbe2ae90a0fce33
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd
F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a
@ -1189,7 +1189,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 565c5af7a75ad5c759ce1a61dab3a61c42819644
R c113c051fb0a0f7ee541f07d792965ad
P 216d21d0e62b3c0ad49f3cb395c845bf4f17ac61
R ccb9d21b3a566e207d222a64f9b56de4
U drh
Z 1016c6f05046b2d8d5d597484d5273e9
Z 93aca20bb7a5a87f1d3c643bafb97dd4

View File

@ -1 +1 @@
216d21d0e62b3c0ad49f3cb395c845bf4f17ac61
3175e366bbf7579ec9ab27214b0a4e5cd27ea204

View File

@ -51,6 +51,7 @@ int sqlite3ThreadCreate(
void *pIn /* Argument passed into xTask() */
){
SQLiteThread *p;
int rc;
assert( ppThread!=0 );
assert( xTask!=0 );
@ -63,7 +64,12 @@ int sqlite3ThreadCreate(
memset(p, 0, sizeof(*p));
p->xTask = xTask;
p->pIn = pIn;
if( sqlite3FaultSim(200) ? 1 : pthread_create(&p->tid, 0, xTask, pIn) ){
if( sqlite3FaultSim(200) ){
rc = 1;
}else{
rc = pthread_create(&p->tid, 0, xTask, pIn);
}
if( rc ){
p->done = 1;
p->pOut = xTask(pIn);
}
@ -76,7 +82,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
int rc;
assert( ppOut!=0 );
if( p==0 ) return SQLITE_NOMEM;
if( NEVER(p==0) ) return SQLITE_NOMEM;
if( p->done ){
*ppOut = p->pOut;
rc = SQLITE_OK;
@ -160,7 +166,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
BOOL bRc;
assert( ppOut!=0 );
if( p==0 ) return SQLITE_NOMEM;
if( NEVER(p==0) ) return SQLITE_NOMEM;
if( p->xTask==0 ){
rc = WAIT_OBJECT_0;
}else{
@ -222,7 +228,7 @@ int sqlite3ThreadCreate(
int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
assert( ppOut!=0 );
if( p==0 ) return SQLITE_NOMEM;
if( NEVER(p==0) ) return SQLITE_NOMEM;
if( p->xTask ){
*ppOut = p->xTask(p->pIn);
}else{

View File

@ -938,11 +938,11 @@ static int vdbeSorterJoinThread(SortSubtask *pTask){
#ifdef SQLITE_DEBUG_SORTER_THREADS
int bDone = pTask->bDone;
#endif
void *pRet;
void *pRet = SQLITE_INT_TO_PTR(SQLITE_ERROR);
vdbeSorterBlockDebug(pTask, !bDone, "enter");
rc = sqlite3ThreadJoin(pTask->pThread, &pRet);
(void)sqlite3ThreadJoin(pTask->pThread, &pRet);
vdbeSorterBlockDebug(pTask, !bDone, "exit");
if( rc==SQLITE_OK ) rc = SQLITE_PTR_TO_INT(pRet);
rc = SQLITE_PTR_TO_INT(pRet);
assert( pTask->bDone==1 );
pTask->bDone = 0;
pTask->pThread = 0;