diff options
author | drh <drh@noemail.net> | 2015-09-30 14:50:39 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-09-30 14:50:39 +0000 |
commit | 32af5eda6a6bd8afaad724fa61166ee92f935af5 (patch) | |
tree | ddf5f23f29daccf300fa9d0188a7a766dfcd560e /src/threads.c | |
parent | 9ec0efd946b8015f8b3ba3b726bc39f0b15d306c (diff) | |
parent | 105865acf9644a66cc73a84dde72937b83dd5315 (diff) | |
download | sqlite-32af5eda6a6bd8afaad724fa61166ee92f935af5.tar.gz sqlite-32af5eda6a6bd8afaad724fa61166ee92f935af5.zip |
Merge recent enhancements from trunk, and especially the fix for
ticket [1b266395d6bc10].
FossilOrigin-Name: b2face9aa95ade96a5666c70b6b31064c1ad0977
Diffstat (limited to 'src/threads.c')
-rw-r--r-- | src/threads.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/threads.c b/src/threads.c index 4ce612227..251b9b763 100644 --- a/src/threads.c +++ b/src/threads.c @@ -67,6 +67,10 @@ int sqlite3ThreadCreate( memset(p, 0, sizeof(*p)); p->xTask = xTask; p->pIn = pIn; + /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a + ** function that returns SQLITE_ERROR when passed the argument 200, that + ** forces worker threads to run sequentially and deterministically + ** for testing purposes. */ if( sqlite3FaultSim(200) ){ rc = 1; }else{ @@ -151,7 +155,12 @@ int sqlite3ThreadCreate( *ppThread = 0; p = sqlite3Malloc(sizeof(*p)); if( p==0 ) return SQLITE_NOMEM; - if( sqlite3GlobalConfig.bCoreMutex==0 ){ + /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a + ** function that returns SQLITE_ERROR when passed the argument 200, that + ** forces worker threads to run sequentially and deterministically + ** (via the sqlite3FaultSim() term of the conditional) for testing + ** purposes. */ + if( sqlite3GlobalConfig.bCoreMutex==0 || sqlite3FaultSim(200) ){ memset(p, 0, sizeof(*p)); }else{ p->xTask = xTask; @@ -179,7 +188,7 @@ int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){ assert( ppOut!=0 ); if( NEVER(p==0) ) return SQLITE_NOMEM; if( p->xTask==0 ){ - assert( p->id==GetCurrentThreadId() ); + /* assert( p->id==GetCurrentThreadId() ); */ rc = WAIT_OBJECT_0; assert( p->tid==0 ); }else{ |