/* _______ __ __ __ __ \ \ ____ __ __ _______ |__|| | | | |__| ____ ____ / | \ _/ __ \ | | \\_ __ \| || | | | | | / _ \ / \ / | \\ ___/ | | / | | \/| || |__| |__| |( <_> )| | \ \____|__ / \___ >|____/ |__| |__||____/|____/|__| \____/ |___| / =========\/======\/=================================================\/== v0.01 03/AUG/2007 (C) Copyright 2007-2007 Scott D. Yelich SOME RIGHTS RESERVED .,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.-*~'`^`'~*-,._.,-*~'`^`'~*-,. LICENSE: Creative Commons Attribution 3.0 License. SEE: http://creativecommons.org/licenses/by/3.0/ Mon Aug 13 23:19:12 EDT 2007, v0.01 sdy This is a *very* simple program written to do test basic sqlite3 functionality. */ // C++ #include #include #include // C #include #include // Yeah, I know I should include the sqlite3.h header file to // get these defined officially -- as this hard coding would // break if the values ever changed -- but this is just a // quick example ... unsigned int const sqlite3_pending_byte = 0x40000000; unsigned int const sqlite3_reserved_byte = sqlite3_pending_byte+1; int msleep(int ms) { struct timespec ts; ts.tv_sec = ms / 1000; ts.tv_nsec = 1000000 * ( ms - ( ts.tv_sec*1000 ) ); while(nanosleep(&ts,&ts) == -1) { continue; } // sleep for full period ... return 1; } int main(int argc, char **argv) { int fd; struct flock fl; int tps = 10; int rc; if ( argv[1] ) { std::cerr << "argv[1]=("<> x; if ( x>0 && x<100 ) { tps = x; } std::cerr << "tps=("< 0 ) { std::cerr << rtry; rtry =0; } std::cerr << ":"; rc = msleep(ms/2); fl.l_type = F_UNLCK; if (fcntl(fd, F_SETLK, &fl) == -1) { std::cerr << "unexpected error=("<