亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? test4.c

?? sqlite庫
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*** 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.17 2006/02/23 21:43:56 drh Exp $*/#include "sqliteInt.h"#include "tcl.h"#include "os.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>/*** Each thread is controlled by an instance of the following** structure.*/typedef struct Thread Thread;struct Thread {  /* The first group of fields are writable by the master and read-only  ** to the thread. */  char *zFilename;       /* Name of database file */  void (*xOp)(Thread*);  /* next operation to do */  char *zArg;            /* argument usable by xOp */  int opnum;             /* Operation number */  int busy;              /* True if this thread is in use */  /* The next group of fields are writable by the thread but read-only to the  ** master. */  int completed;        /* Number of operations completed */  sqlite3 *db;           /* Open database */  sqlite3_stmt *pStmt;     /* Pending operation */  char *zErr;           /* operation error */  char *zStaticErr;     /* Static error message */  int rc;               /* operation return code */  int argc;             /* number of columns in result */  const char *argv[100];    /* result columns */  const char *colv[100];    /* result column names */};/*** There can be as many as 26 threads running at once.  Each is named** by a capital letter: A, B, C, ..., Y, Z.*/#define N_THREAD 26static Thread threadset[N_THREAD];/*** The main loop for a thread.  Threads use busy waiting. */static void *thread_main(void *pArg){  Thread *p = (Thread*)pArg;  if( p->db ){    sqlite3_close(p->db);  }  sqlite3_open(p->zFilename, &p->db);  if( SQLITE_OK!=sqlite3_errcode(p->db) ){    p->zErr = strdup(sqlite3_errmsg(p->db));    sqlite3_close(p->db);    p->db = 0;  }  p->pStmt = 0;  p->completed = 1;  while( p->opnum<=p->completed ) sched_yield();  while( p->xOp ){    if( p->zErr && p->zErr!=p->zStaticErr ){      sqlite3_free(p->zErr);      p->zErr = 0;    }    (*p->xOp)(p);    p->completed++;    while( p->opnum<=p->completed ) sched_yield();  }  if( p->pStmt ){    sqlite3_finalize(p->pStmt);    p->pStmt = 0;  }  if( p->db ){    sqlite3_close(p->db);    p->db = 0;  }  if( p->zErr && p->zErr!=p->zStaticErr ){    sqlite3_free(p->zErr);    p->zErr = 0;  }  p->completed++;  sqlite3_thread_cleanup();  return 0;}/*** Get a thread ID which is an upper case letter.  Return the index.** If the argument is not a valid thread ID put an error message in** the interpreter and return -1.*/static int parse_thread_id(Tcl_Interp *interp, const char *zArg){  if( zArg==0 || zArg[0]==0 || zArg[1]!=0 || !isupper((unsigned char)zArg[0]) ){    Tcl_AppendResult(interp, "thread ID must be an upper case letter", 0);    return -1;  }  return zArg[0] - 'A';}/*** Usage:    thread_create NAME  FILENAME**** NAME should be an upper case letter.  Start the thread running with** an open connection to the given database.*/static int tcl_thread_create(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  int i;  pthread_t x;  int rc;  if( argc!=3 ){    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],       " ID FILENAME", 0);    return TCL_ERROR;  }  i = parse_thread_id(interp, argv[1]);  if( i<0 ) return TCL_ERROR;  if( threadset[i].busy ){    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;  }  pthread_detach(x);  return TCL_OK;}/*** Wait for a thread to reach its idle state.*/static void thread_wait(Thread *p){  while( p->opnum>p->completed ) sched_yield();}/*** Usage:  thread_wait ID**** Wait on thread ID to reach its idle state.*/static int tcl_thread_wait(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  int i;  if( argc!=2 ){    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],       " ID", 0);    return TCL_ERROR;  }  i = parse_thread_id(interp, argv[1]);  if( i<0 ) return TCL_ERROR;  if( !threadset[i].busy ){    Tcl_AppendResult(interp, "no such thread", 0);    return TCL_ERROR;  }  thread_wait(&threadset[i]);  return TCL_OK;}/*** Stop a thread.*/static void stop_thread(Thread *p){  thread_wait(p);  p->xOp = 0;  p->opnum++;  thread_wait(p);  sqliteFree(p->zArg);  p->zArg = 0;  sqliteFree(p->zFilename);  p->zFilename = 0;  p->busy = 0;}/*** Usage:  thread_halt ID**** Cause a thread to shut itself down.  Wait for the shutdown to be** completed.  If ID is "*" then stop all threads.*/static int tcl_thread_halt(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  int i;  if( argc!=2 ){    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],       " ID", 0);    return TCL_ERROR;  }  if( argv[1][0]=='*' && argv[1][1]==0 ){    for(i=0; i<N_THREAD; i++){      if( threadset[i].busy ) stop_thread(&threadset[i]);    }  }else{    i = parse_thread_id(interp, argv[1]);    if( i<0 ) return TCL_ERROR;    if( !threadset[i].busy ){      Tcl_AppendResult(interp, "no such thread", 0);      return TCL_ERROR;    }    stop_thread(&threadset[i]);  }  return TCL_OK;}/*** Usage: thread_argc  ID**** Wait on the most recent thread_step to complete, then return the** number of columns in the result set.*/static int tcl_thread_argc(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  int i;  char zBuf[100];  if( argc!=2 ){    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],       " ID", 0);    return TCL_ERROR;  }  i = parse_thread_id(interp, argv[1]);  if( i<0 ) return TCL_ERROR;  if( !threadset[i].busy ){    Tcl_AppendResult(interp, "no such thread", 0);    return TCL_ERROR;  }  thread_wait(&threadset[i]);  sprintf(zBuf, "%d", threadset[i].argc);  Tcl_AppendResult(interp, zBuf, 0);  return TCL_OK;}/*** Usage: thread_argv  ID   N**** Wait on the most recent thread_step to complete, then return the** value of the N-th columns in the result set.*/static int tcl_thread_argv(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  int i;  int n;  if( argc!=3 ){    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],       " ID N", 0);    return TCL_ERROR;  }  i = parse_thread_id(interp, argv[1]);  if( i<0 ) return TCL_ERROR;  if( !threadset[i].busy ){    Tcl_AppendResult(interp, "no such thread", 0);    return TCL_ERROR;  }  if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;  thread_wait(&threadset[i]);  if( n<0 || n>=threadset[i].argc ){    Tcl_AppendResult(interp, "column number out of range", 0);    return TCL_ERROR;  }  Tcl_AppendResult(interp, threadset[i].argv[n], 0);  return TCL_OK;}/*** Usage: thread_colname  ID   N**** Wait on the most recent thread_step to complete, then return the** name of the N-th columns in the result set.*/static int tcl_thread_colname(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  int i;  int n;  if( argc!=3 ){    Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],       " ID N", 0);    return TCL_ERROR;  }  i = parse_thread_id(interp, argv[1]);  if( i<0 ) return TCL_ERROR;  if( !threadset[i].busy ){    Tcl_AppendResult(interp, "no such thread", 0);    return TCL_ERROR;  }  if( Tcl_GetInt(interp, argv[2], &n) ) return TCL_ERROR;  thread_wait(&threadset[i]);  if( n<0 || n>=threadset[i].argc ){    Tcl_AppendResult(interp, "column number out of range", 0);    return TCL_ERROR;  }  Tcl_AppendResult(interp, threadset[i].colv[n], 0);  return TCL_OK;}/*** Usage: thread_result  ID**** Wait on the most recent operation to complete, then return the** result code from that operation.*/static int tcl_thread_result(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩中文字幕亚洲一区二区va在线| 亚洲成人免费看| 欧美电影影音先锋| 成人福利在线看| 久久99最新地址| 亚洲成a人片综合在线| 中文字幕av在线一区二区三区| 欧美一区日本一区韩国一区| 91丨porny丨在线| 国产精品亚洲一区二区三区在线 | 亚洲电影中文字幕在线观看| 精品国产免费人成在线观看| 欧美视频一区二区三区| 成人开心网精品视频| 理论电影国产精品| 性做久久久久久久免费看| 国产精品成人一区二区艾草| 久久日韩粉嫩一区二区三区| 91精品国产综合久久精品app| 成人动漫视频在线| 国产精品123区| 精品一区二区三区影院在线午夜 | 在线成人免费观看| 色狠狠色噜噜噜综合网| 91在线视频网址| 成人午夜在线免费| 国产二区国产一区在线观看| 久久超碰97中文字幕| 日日摸夜夜添夜夜添国产精品| 一区二区三区四区乱视频| 日韩一区在线播放| 国产精品国产自产拍高清av| 久久久久久一级片| 亚洲精品在线电影| 欧美精品一区二区三区在线播放| 欧美一级片在线| 欧美一级夜夜爽| 日韩欧美资源站| 日韩一级免费观看| 日韩三级视频中文字幕| 欧美成人vps| 久久综合久久99| 国产香蕉久久精品综合网| 国产无遮挡一区二区三区毛片日本 | 成人综合婷婷国产精品久久蜜臀 | 日韩三级伦理片妻子的秘密按摩| 欧美精品 国产精品| 91精品国产麻豆国产自产在线 | 在线精品视频免费播放| 日本乱人伦aⅴ精品| 欧美在线一区二区三区| 欧美色综合影院| 日韩一区二区电影在线| 久久综合资源网| 亚洲国产高清在线| 亚洲免费av在线| 视频一区国产视频| 精品一区二区三区免费毛片爱| 黑人巨大精品欧美一区| 成人性生交大片免费看视频在线 | 在线精品视频一区二区| 91麻豆精品国产自产在线| 精品国产乱码久久久久久久 | 91美女精品福利| 欧美在线综合视频| 欧美一区二区人人喊爽| 国产婷婷精品av在线| 一区二区三区毛片| 玖玖九九国产精品| 成人国产免费视频| 欧美日韩一二三| 久久久久久久久一| 亚洲欧洲综合另类| 蜜桃一区二区三区在线| 盗摄精品av一区二区三区| 欧美视频在线一区| 国产午夜亚洲精品不卡| 亚洲一区在线播放| 黑人巨大精品欧美一区| 91蜜桃视频在线| 精品美女一区二区三区| 亚洲欧美区自拍先锋| 久久精品免费观看| 色一情一乱一乱一91av| 欧美大片国产精品| 亚洲免费在线电影| 国产一区二区调教| 欧美日韩在线播| 中文字幕av一区二区三区| 日韩一区精品字幕| 99精品黄色片免费大全| 1000部国产精品成人观看| 国产黄人亚洲片| 亚洲视频在线一区| 欧美人xxxx| 国产呦精品一区二区三区网站| 国产欧美日韩麻豆91| 色综合色综合色综合| 偷拍与自拍一区| 337p粉嫩大胆噜噜噜噜噜91av| 高清久久久久久| 亚洲综合男人的天堂| 欧美一区二区三区成人| 成人丝袜视频网| 亚洲成人高清在线| 久久综合九色综合欧美98| www.欧美日韩| 日韩高清不卡在线| 中文字幕免费在线观看视频一区| 在线免费精品视频| 精品一区二区三区免费毛片爱 | 91老师国产黑色丝袜在线| 午夜一区二区三区视频| 久久久久9999亚洲精品| 欧美日韩国产高清一区| 成人综合在线视频| 蜜臀av国产精品久久久久| 日韩毛片视频在线看| 日韩欧美国产一区二区三区| 91在线视频在线| 国产精品一区二区黑丝| 午夜精品视频一区| 亚洲人成网站精品片在线观看| 日韩视频免费观看高清完整版 | 国产成人午夜视频| 日韩不卡手机在线v区| 亚洲人吸女人奶水| 国产亚洲一区二区三区| 欧美午夜不卡在线观看免费| 成人免费高清在线| 精品制服美女丁香| 午夜电影网亚洲视频| 亚洲图片激情小说| 国产亚洲综合性久久久影院| 欧美一区二区久久久| 欧美在线free| 91在线国产观看| 成人免费毛片嘿嘿连载视频| 狠狠色狠狠色综合| 久久国内精品自在自线400部| 亚洲国产欧美在线| 亚洲特级片在线| 中文字幕人成不卡一区| 欧美国产一区视频在线观看| 欧美精品一区二区三区一线天视频| 欧美日韩一卡二卡| 在线观看欧美黄色| 91黄色免费版| 色婷婷亚洲精品| 欧美丝袜丝nylons| 欧美日韩一区二区三区免费看 | 青青草成人在线观看| 亚洲国产日韩av| 婷婷开心久久网| 天天做天天摸天天爽国产一区| 亚洲一级片在线观看| 亚洲综合激情另类小说区| 一区二区三区在线观看动漫| 亚洲综合成人在线视频| 日韩av不卡在线观看| 日产国产欧美视频一区精品| 青青草国产成人av片免费| 精品中文av资源站在线观看| 国产精品自拍一区| 丁香另类激情小说| 91片在线免费观看| 欧美日韩在线免费视频| 欧美一区在线视频| 国产日产精品一区| 亚洲美女免费视频| 日韩主播视频在线| 国产麻豆9l精品三级站| 成人精品国产福利| 欧美在线一二三| 欧美一区二区三区视频| 国产婷婷色一区二区三区在线| 亚洲图片欧美激情| 日本一区中文字幕| 国产精品综合一区二区三区| 色哟哟一区二区| 日韩欧美另类在线| 亚洲欧洲精品一区二区三区| 亚洲曰韩产成在线| 国产资源在线一区| 91色乱码一区二区三区| 欧美大片一区二区三区| 中文字幕亚洲区| 精品一区二区免费在线观看| 国产成人av电影| 欧美妇女性影城| 国产精品素人一区二区| 男女男精品视频| 91亚洲精品一区二区乱码| 在线电影欧美成精品| 国产精品久久看| 久久精品二区亚洲w码| 91在线国产福利| 国产亚洲精品中文字幕| 亚洲国产一区二区三区| 国产黄色91视频|