/ Check-in [0561272a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix minor errors causing compilation to fail with SQLITE_MAX_WORKER_THREADS set to a value greater than zero.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | threads
Files: files | file ages | folders
SHA1: 0561272abf357a2f4709f6c02866e570d19cd344
User & Date: dan 2014-04-03 14:29:08
Context
2014-04-03
16:25
Fix an integer overflow problem in the sorter. check-in: 9d3351b8 user: dan tags: threads
14:29
Fix minor errors causing compilation to fail with SQLITE_MAX_WORKER_THREADS set to a value greater than zero. check-in: 0561272a user: dan tags: threads
02:54
Refactor local object and method names in vdbesort.c so that their names more closely reflect their actual use. check-in: d284e30e user: drh tags: threads
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbesort.c.

   732    732   */
   733    733   #if SQLITE_MAX_WORKER_THREADS>0
   734    734   static int vdbeSorterJoinAll(VdbeSorter *pSorter, int rcin){
   735    735     int rc = rcin;
   736    736     int i;
   737    737     for(i=0; i<pSorter->nTask; i++){
   738    738       SortSubtask *pTask = &pSorter->aTask[i];
   739         -    if( pTask->pTask ){
          739  +    if( pTask->pThread ){
   740    740         void *pRet;
   741         -      int rc2 = sqlite3ThreadJoin(pTask->pTask, &pRet);
   742         -      pTask->pTask = 0;
          741  +      int rc2 = sqlite3ThreadJoin(pTask->pThread, &pRet);
          742  +      pTask->pThread = 0;
   743    743         pTask->bDone = 0;
   744    744         if( rc==SQLITE_OK ) rc = rc2;
   745    745         if( rc==SQLITE_OK ) rc = SQLITE_PTR_TO_INT(pRet);
   746    746       }
   747    747     }
   748    748     return rc;
   749    749   }
................................................................................
  1308   1308     pSorter->bUsePMA = 1;
  1309   1309     for(i=0; i<nWorker; i++){
  1310   1310       int iTest = (pSorter->iPrev + i + 1) % nWorker;
  1311   1311       pTask = &pSorter->aTask[iTest];
  1312   1312   #if SQLITE_MAX_WORKER_THREADS>0
  1313   1313       if( pTask->bDone ){
  1314   1314         void *pRet;
  1315         -      assert( pTask->pTask );
  1316         -      rc = sqlite3ThreadJoin(pTask->pTask, &pRet);
  1317         -      pTask->pTask = 0;
         1315  +      assert( pTask->pThread );
         1316  +      rc = sqlite3ThreadJoin(pTask->pThread, &pRet);
         1317  +      pTask->pThread = 0;
  1318   1318         pTask->bDone = 0;
  1319   1319         if( rc==SQLITE_OK ){
  1320   1320           rc = SQLITE_PTR_TO_INT(pRet);
  1321   1321         }
  1322   1322       }
  1323   1323   #endif
  1324   1324       if( pTask->pThread==0 ) break;
................................................................................
  1352   1352           if( pSorter->aMemory==0 ){
  1353   1353             pSorter->aMemory = sqlite3Malloc(pSorter->nMemory);
  1354   1354             if( pSorter->aMemory==0 ) return SQLITE_NOMEM;
  1355   1355           }else{
  1356   1356             pSorter->nMemory = sqlite3MallocSize(pSorter->aMemory);
  1357   1357           }
  1358   1358         }
  1359         -      rc = sqlite3ThreadCreate(&pTask->pTask, vdbeSortSubtaskMain, pCtx);
         1359  +      rc = sqlite3ThreadCreate(&pTask->pThread, vdbeSortSubtaskMain, pCtx);
  1360   1360       }else
  1361   1361   #endif
  1362   1362       {
  1363   1363         /* Use the foreground thread for this operation */
  1364   1364         rc = vdbeSorterRunTask(pTask);
  1365   1365         if( rc==SQLITE_OK ){
  1366   1366           u8 *aMem = pTask->aListMemory;
................................................................................
  1527   1527         if( pTask->pTemp1 ){
  1528   1528           pTask->nConsolidate = SORTER_MAX_MERGE_COUNT / pSorter->nTask;
  1529   1529           pTask->eWork = SORT_SUBTASK_CONS;
  1530   1530   
  1531   1531   #if SQLITE_MAX_WORKER_THREADS>0
  1532   1532           if( i<(pSorter->nTask-1) ){
  1533   1533             void *pCtx = (void*)pTask;
  1534         -          rc = sqlite3ThreadCreate(&pTask->pTask,vdbeSortSubtaskMain,pCtx);
         1534  +          rc = sqlite3ThreadCreate(&pTask->pThread, vdbeSortSubtaskMain, pCtx);
  1535   1535           }else
  1536   1536   #endif
  1537   1537           {
  1538   1538             rc = vdbeSorterRunTask(pTask);
  1539   1539           }
  1540   1540         }
  1541   1541       }