/ Check-in [9f19420b]
Login

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

Overview
Comment:Add mutex operations to test code in test3.c to avoid triggering assert() failures in certain configurations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9f19420b0a79dff65fc3a9d548f4b3fc4955f9f9
User & Date: dan 2015-10-30 20:54:25
Context
2015-11-01
21:19
If a table-constraint PRIMARY KEY lists a single column in single-quotes and that column has type INTEGER, then make that column an integer primary key, for historical compatibility. Fix for ticket [ac661962a2aeab3c331]. check-in: db319a03 user: drh tags: trunk
2015-10-31
17:58
On unix, if a file is opened via a symlink, create, read and write journal and wal files based on the name of the actual db file, not the symlink. Closed-Leaf check-in: c7c81050 user: dan tags: follow-symlinks
2015-10-30
20:54
Add mutex operations to test code in test3.c to avoid triggering assert() failures in certain configurations. check-in: 9f19420b user: dan tags: trunk
16:36
Increase the version number to 3.10.0, due to the addition of the sqlite3_db_cacheflush() interface. check-in: 7565b046 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test3.c.

   213    213     }
   214    214     pBt = sqlite3TestTextToPtr(argv[1]);
   215    215     if( Tcl_GetInt(interp, argv[2], &iTable) ) return TCL_ERROR;
   216    216     if( Tcl_GetBoolean(interp, argv[3], &wrFlag) ) return TCL_ERROR;
   217    217     if( wrFlag ) wrFlag = BTREE_WRCSR;
   218    218     pCur = (BtCursor *)ckalloc(sqlite3BtreeCursorSize());
   219    219     memset(pCur, 0, sqlite3BtreeCursorSize());
          220  +  sqlite3_mutex_enter(pBt->db->mutex);
   220    221     sqlite3BtreeEnter(pBt);
   221    222   #ifndef SQLITE_OMIT_SHARED_CACHE
   222    223     rc = sqlite3BtreeLockTable(pBt, iTable, !!wrFlag);
   223    224   #endif
   224    225     if( rc==SQLITE_OK ){
   225    226       rc = sqlite3BtreeCursor(pBt, iTable, wrFlag, 0, pCur);
   226    227     }
   227    228     sqlite3BtreeLeave(pBt);
          229  +  sqlite3_mutex_leave(pBt->db->mutex);
   228    230     if( rc ){
   229    231       ckfree((char *)pCur);
   230    232       Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
   231    233       return TCL_ERROR;
   232    234     }
   233    235     sqlite3_snprintf(sizeof(zBuf), zBuf,"%p", pCur);
   234    236     Tcl_AppendResult(interp, zBuf, 0);
................................................................................
   253    255     if( argc!=2 ){
   254    256       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
   255    257          " ID\"", 0);
   256    258       return TCL_ERROR;
   257    259     }
   258    260     pCur = sqlite3TestTextToPtr(argv[1]);
   259    261     pBt = pCur->pBtree;
          262  +  sqlite3_mutex_enter(pBt->db->mutex);
   260    263     sqlite3BtreeEnter(pBt);
   261    264     rc = sqlite3BtreeCloseCursor(pCur);
   262    265     sqlite3BtreeLeave(pBt);
          266  +  sqlite3_mutex_leave(pBt->db->mutex);
   263    267     ckfree((char *)pCur);
   264    268     if( rc ){
   265    269       Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
   266    270       return TCL_ERROR;
   267    271     }
   268    272     return SQLITE_OK;
   269    273   }
................................................................................
   626    630       if( Tcl_GetIntFromObj(interp, objv[2], &nKey) ) return TCL_ERROR;
   627    631       pData = (void*)Tcl_GetByteArrayFromObj(objv[3], &nData);
   628    632     }else{
   629    633       pKey = (void*)Tcl_GetByteArrayFromObj(objv[2], &nKey);
   630    634     }
   631    635     pCur = (BtCursor*)sqlite3TestTextToPtr(Tcl_GetString(objv[1]));
   632    636   
          637  +  sqlite3_mutex_enter(pCur->pBtree->db->mutex);
   633    638     sqlite3BtreeEnter(pCur->pBtree);
   634    639     rc = sqlite3BtreeInsert(pCur, pKey, nKey, pData, nData, 0, 0, 0);
   635    640     sqlite3BtreeLeave(pCur->pBtree);
          641  +  sqlite3_mutex_leave(pCur->pBtree->db->mutex);
   636    642   
   637    643     Tcl_ResetResult(interp);
   638    644     if( rc ){
   639    645       Tcl_AppendResult(interp, sqlite3ErrName(rc), 0);
   640    646       return TCL_ERROR;
   641    647     }
   642    648     return TCL_OK;