#pragma ident "%Z%%M% %I% %E% SMI"
/*
** 2004 January 13
**
** 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.
**
** This file is NOT part of the standard SQLite library. It is used for
** testing only.
*/
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include "sqlite.h"
/*
** Name of the database
*/
/*
** When this variable becomes non-zero, all threads stop
** what they are doing.
*/
volatile int all_stop = 0;
/*
** Callback from the integrity check. If the result is anything other
** than "ok" it means the integrity check has failed. Set the "all_stop"
** global variable to stop all other activity. Print the error message
** or print OK if the string "ok" is seen.
*/
all_stop = 1;
}else{
/* fprintf(stderr,"pid=%d. OK\n", getpid()); */
}
return 0;
}
/*
** Do an integrity check on the database. If the first integrity check
** fails, try it a second time.
*/
int rc;
if( all_stop ) return 0;
/* fprintf(stderr,"pid=%d: CHECK\n", getpid()); */
}
if( all_stop ){
}
return 0;
}
/*
** This is the worker thread
*/
int rc;
int cnt = 0;
/* fprintf(stderr, "pid=%d: BEGIN\n", getpid()); */
/* fprintf(stderr, "pid=%d: END rc=%d\n", getpid(), rc); */
}
return 0;
}
/*
** Initialize the database and start the threads
*/
int i, rc;
if( db==0 ){
exit(1);
}
if( rc ){
exit(1);
}
}
pthread_join(aThread[i], 0);
}
if( !all_stop ){
printf("Everything seems ok.\n");
return 0;
}else{
printf("We hit an error.\n");
return 1;
}
}