#pragma ident "%Z%%M% %I% %E% SMI"
/*
** 2002 January 15
**
** 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.
**
*************************************************************************
** This file implements a simple standalone program used to test whether
** or not the SQLite library is threadsafe.
**
** Testing the thread safety of SQLite is difficult because there are very
** few places in the code that are even potentially unsafe, and those
** places execute for very short periods of time. So even if the library
** is compiled with its mutexes disabled, it is likely to work correctly
** in a multi-threaded program most of the time.
**
** This file is NOT part of the standard SQLite library. It is used for
** testing only.
*/
#include "sqlite.h"
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
** Enable for tracing
*/
static int verbose = 0;
/*
** Come here to die.
*/
}
extern char *sqlite_mprintf(const char *zFormat, ...);
/*
** When a lock occurs, yield.
*/
/* sched_yield(); */
usleep(100);
return 1;
}
/*
** Used to accumulate query results by db_query()
*/
struct QueryResult {
};
/*
** The callback function for db_query
*/
static int db_query_callback(
void *pUser, /* Pointer to the QueryResult structure */
int nArg, /* Number of columns in this result row */
char **azArg, /* Text of data in all columns */
char **NotUsed /* Names of the columns */
){
int i;
}else{
}
return 1;
}
}
if( azArg==0 ) return 0;
for(i=0; i<nArg; i++){
}
return 0;
}
/*
** Execute a query against the database. NULL values are returned
** as an empty string. The list is terminated by a single NULL pointer.
*/
char *zSql;
int rc;
char *zErrMsg = 0;
if( rc==SQLITE_SCHEMA ){
}
if( zErrMsg ){
Exit(1);
}
db_query_callback(&sResult, 0, 0, 0);
}
}
/*
** Execute an SQL statement.
*/
char *zSql;
int rc;
char *zErrMsg = 0;
while( rc==SQLITE_SCHEMA ){
}
if( zErrMsg ){
Exit(1);
}
}
/*
** Free the results of a db_query() call.
*/
int i;
for(i=0; az[i]; i++){
sqlite_freemem(az[i]);
}
}
/*
** Check results
*/
int i;
char *z;
Exit(1);
}
}
}
int thread_cnt = 0;
char *azErr;
int i, cnt;
char **az;
thread_cnt++;
if( db==0 ){
Exit(1);
}
for(i=1; i<=100; i++){
t, i, i*2, i*i);
}
for(i=1; i<=50; i++){
}
}
/* unlink(zFilename); */
thread_cnt--;
if( thread_cnt<=0 ){
}
return 0;
}
char *zFile;
int i, n;
verbose = 1;
argc--;
argv++;
}
for(i=0; i<n; i++){
}
for(i=0; i<n; i++){
}
while( thread_cnt>0 ){
}
for(i=0; i<n; i++){
}
return 0;
}