SQLite

Check-in [952924084a]
Login

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

Overview
Comment:Fix some minor problems with the new test4.c module used for doing thread testing. (CVS 1142)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 952924084aac4a7fa84a7cb7aaac869d35db1896
User & Date: drh 2003-12-20 04:00:53.000
Context
2003-12-22
14:53
Optimizations to the LEMON parser template. (CVS 1143) (check-in: 06db29df8f user: drh tags: trunk)
2003-12-20
04:00
Fix some minor problems with the new test4.c module used for doing thread testing. (CVS 1142) (check-in: 952924084a user: drh tags: trunk)
2003-12-19
20:09
Update configuration and make files for mingw/msys on Windows (CVS 1141) (check-in: 1e9689672c user: dougcurrie tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test4.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
** 2003 December 18
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the the SQLite library in a multithreaded environment.
**
** $Id: test4.c,v 1.1 2003/12/19 02:52:09 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(OS_UNIX) && defined(THREADSAFE) && THREADSAFE==1
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sched.h>
#include <ctype.h>

/*













|



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
** 2003 December 18
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the the SQLite library in a multithreaded environment.
**
** $Id: test4.c,v 1.2 2003/12/20 04:00:53 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#if defined(OS_UNIX) && OS_UNIX==1 && defined(THREADSAFE) && THREADSAFE==1
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sched.h>
#include <ctype.h>

/*
134
135
136
137
138
139
140

141
142
143
144
145
146
147
    Tcl_AppendResult(interp, "thread ", argv[1], " is already running", 0);
    return TCL_ERROR;
  }
  threadset[i].busy = 1;
  sqliteFree(threadset[i].zFilename);
  threadset[i].zFilename = sqliteStrDup(argv[2]);
  threadset[i].opnum = 1;

  rc = pthread_create(&x, 0, thread_main, &threadset[i]);
  if( rc ){
    Tcl_AppendResult(interp, "failed to create the thread", 0);
    sqliteFree(threadset[i].zFilename);
    threadset[i].busy = 0;
    return TCL_ERROR;
  }







>







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
    Tcl_AppendResult(interp, "thread ", argv[1], " is already running", 0);
    return TCL_ERROR;
  }
  threadset[i].busy = 1;
  sqliteFree(threadset[i].zFilename);
  threadset[i].zFilename = sqliteStrDup(argv[2]);
  threadset[i].opnum = 1;
  threadset[i].completed = 0;
  rc = pthread_create(&x, 0, thread_main, &threadset[i]);
  if( rc ){
    Tcl_AppendResult(interp, "failed to create the thread", 0);
    sqliteFree(threadset[i].zFilename);
    threadset[i].busy = 0;
    return TCL_ERROR;
  }