您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sqlite3MutexAlloc函数代码示例

51自学网 2021-06-03 08:14:22
  C++
这篇教程C++ sqlite3MutexAlloc函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sqlite3MutexAlloc函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlite3MutexAlloc函数的具体用法?C++ sqlite3MutexAlloc怎么用?C++ sqlite3MutexAlloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sqlite3MutexAlloc函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: currentTimeFunc

/*** If the library is compiled to omit the full-scale date and time** handling (to get a smaller binary), the following minimal version** of the functions current_time(), current_date() and current_timestamp()** are included instead. This is to support column declarations that** include "DEFAULT CURRENT_TIME" etc.**** This function uses the C-library functions time(), gmtime()** and strftime(). The format string to pass to strftime() is supplied** as the user-data for the function.*/static void currentTimeFunc(  sqlite3_context *context,  int argc,  sqlite3_value **argv){  time_t t;  char *zFormat = (char *)sqlite3_user_data(context);  sqlite3 *db;  sqlite3_int64 iT;  struct tm *pTm;  struct tm sNow;  char zBuf[20];  UNUSED_PARAMETER(argc);  UNUSED_PARAMETER(argv);  iT = sqlite3StmtCurrentTime(context);  if( iT<=0 ) return;  t = iT/1000 - 10000*(sqlite3_int64)21086676;#if HAVE_GMTIME_R  pTm = gmtime_r(&t, &sNow);#else  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));  pTm = gmtime(&t);  if( pTm ) memcpy(&sNow, pTm, sizeof(sNow));  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));#endif  if( pTm ){    strftime(zBuf, 20, zFormat, &sNow);    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);  }}
开发者ID:1018824313,项目名称:sqlite,代码行数:43,


示例2: activate_openssl

static void activate_openssl() {  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));  if(EVP_get_cipherbyname(CIPHER) == NULL) {    OpenSSL_add_all_algorithms();  }   sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));}
开发者ID:TheDleo,项目名称:ocRosa,代码行数:7,


示例3: stmtLruAdd

/*** Add vdbe p to the end of the statement lru list. It is assumed that** p is not already part of the list when this is called. The lru list** is protected by the SQLITE_MUTEX_STATIC_LRU mutex.*/static void stmtLruAdd(Vdbe *p){  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));  if( p->pLruPrev || p->pLruNext || sqlite3LruStatements.pFirst==p ){    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));    return;  }  assert( stmtLruCheck() );  if( !sqlite3LruStatements.pFirst ){    assert( !sqlite3LruStatements.pLast );    sqlite3LruStatements.pFirst = p;    sqlite3LruStatements.pLast = p;  }else{    assert( !sqlite3LruStatements.pLast->pLruNext );    p->pLruPrev = sqlite3LruStatements.pLast;    sqlite3LruStatements.pLast->pLruNext = p;    sqlite3LruStatements.pLast = p;  }  assert( stmtLruCheck() );  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));}
开发者ID:shenjian74,项目名称:Bitcoin-History,代码行数:30,


示例4: sqlite3AutoLoadExtensions

/*** Load all automatic extensions.*/int sqlite3AutoLoadExtensions(sqlite3 *db){  int i;  int go = 1;  int rc = SQLITE_OK;  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);  if( autoext.nExt==0 ){    /* Common case: early out without every having to acquire a mutex */    return SQLITE_OK;  }  for(i=0; go; i++){    char *zErrmsg = 0;#ifndef SQLITE_MUTEX_NOOP    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif    sqlite3_mutex_enter(mutex);    if( i>=autoext.nExt ){      xInit = 0;      go = 0;    }else{      xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))              autoext.aExt[i];    }    sqlite3_mutex_leave(mutex);    if( xInit && xInit(db, &zErrmsg, &sqlite3Apis) ){      sqlite3Error(db, SQLITE_ERROR,            "automatic extension loading failed: %s", zErrmsg);      go = 0;      rc = SQLITE_ERROR;      sqlite3_free(zErrmsg);    }  }  return rc;}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:37,


示例5: sqlite3_auto_extension

/* ** Register a statically linked extension that is automatically ** loaded by every new database connection. */SQLITE_API int sqlite3_auto_extension(void (*xInit)(void)){    int rc = SQLITE_OK;#ifndef SQLITE_OMIT_AUTOINIT    rc = sqlite3_initialize();    if( rc ){        return rc;    }else#endif    {        int i;#if SQLITE_THREADSAFE        sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif        wsdAutoextInit;        sqlite3_mutex_enter(mutex);        for(i=0; i<wsdAutoext.nExt; i++){            if( wsdAutoext.aExt[i]==xInit ) break;        }        if( i==wsdAutoext.nExt ){            int nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);            void (**aNew)(void);            aNew = sqlite3_realloc(wsdAutoext.aExt, nByte);            if( aNew==0 ){                rc = SQLITE_NOMEM;            }else{                wsdAutoext.aExt = aNew;                wsdAutoext.aExt[wsdAutoext.nExt] = xInit;                wsdAutoext.nExt++;            }        }        sqlite3_mutex_leave(mutex);        assert( (rc&0xff)==rc );        return rc;    }}
开发者ID:pchernev,项目名称:Objective-C-iOS-Categories,代码行数:39,


示例6: sqlite3AutoLoadExtensions

/* ** Load all automatic extensions. ** ** If anything goes wrong, set an error in the database connection. */SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){    int i;    int go = 1;    int rc;    int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);        wsdAutoextInit;    if( wsdAutoext.nExt==0 ){        /* Common case: early out without every having to acquire a mutex */        return;    }    for(i=0; go; i++){        char *zErrmsg;#if SQLITE_THREADSAFE        sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif        sqlite3_mutex_enter(mutex);        if( i>=wsdAutoext.nExt ){            xInit = 0;            go = 0;        }else{            xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))            wsdAutoext.aExt[i];        }        sqlite3_mutex_leave(mutex);        zErrmsg = 0;        if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){            sqlite3Error(db, rc,                         "automatic extension loading failed: %s", zErrmsg);            go = 0;        }        sqlite3_free(zErrmsg);    }}
开发者ID:pchernev,项目名称:Objective-C-iOS-Categories,代码行数:39,


示例7: btree_open

/*** Usage:   btree_open FILENAME NCACHE**** Open a new database*/static int btree_open(  void *NotUsed,  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */  int argc,              /* Number of arguments */  const char **argv      /* Text of each argument */){  Btree *pBt;  int rc, nCache;  char zBuf[100];  if( argc!=3 ){    Tcl_AppendResult(interp, "wrong # args: should be /"", argv[0],       " FILENAME NCACHE FLAGS/"", 0);    return TCL_ERROR;  }  if( Tcl_GetInt(interp, argv[2], &nCache) ) return TCL_ERROR;  nRefSqlite3++;  if( nRefSqlite3==1 ){    sDb.pVfs = sqlite3_vfs_find(0);    sDb.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);    sqlite3_mutex_enter(sDb.mutex);  }  rc = sqlite3BtreeOpen(sDb.pVfs, argv[1], &sDb, &pBt, 0,      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB);  if( rc!=SQLITE_OK ){    Tcl_AppendResult(interp, errorName(rc), 0);    return TCL_ERROR;  }  sqlite3BtreeSetCacheSize(pBt, nCache);  sqlite3_snprintf(sizeof(zBuf), zBuf,"%p", pBt);  Tcl_AppendResult(interp, zBuf, 0);  return TCL_OK;}
开发者ID:AlexL871,项目名称:rt-thread-stm32f4discovery,代码行数:37,


示例8: sqlite3MallocInit

/*** Initialize the memory allocation subsystem.*/int sqlite3MallocInit(void){  int rc;  if( sqlite3GlobalConfig.m.xMalloc==0 ){    sqlite3MemSetDefault();  }  memset(&mem0, 0, sizeof(mem0));  mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512      || sqlite3GlobalConfig.nPage<=0 ){    sqlite3GlobalConfig.pPage = 0;    sqlite3GlobalConfig.szPage = 0;  }  rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);  if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));/* BEGIN SQLCIPHER */#ifdef SQLITE_HAS_CODEC  /* install wrapping functions for memory management     that will wipe all memory allocated by SQLite     when freed */  if( rc==SQLITE_OK ) {    extern void sqlcipher_init_memmethods(void);    sqlcipher_init_memmethods();  }#endif/* END SQLCIPHER */  return rc;}
开发者ID:SCALE-GmbH,项目名称:sqlcipher,代码行数:30,


示例9: osLocaltime

/*** The following routine implements the rough equivalent of localtime_r()** using whatever operating-system specific localtime facility that** is available.  This routine returns 0 on success and** non-zero on any kind of error.**** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this** routine will always fail.**** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C** library function localtime_r() is used to assist in the calculation of** local time.*/static int osLocaltime(time_t *t, struct tm *pTm){  int rc;#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S  struct tm *pX;#if SQLITE_THREADSAFE>0  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif  sqlite3_mutex_enter(mutex);  pX = localtime(t);#ifndef SQLITE_OMIT_BUILTIN_TEST  if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;#endif  if( pX ) *pTm = *pX;  sqlite3_mutex_leave(mutex);  rc = pX==0;#else#ifndef SQLITE_OMIT_BUILTIN_TEST  if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;#endif#if HAVE_LOCALTIME_R  rc = localtime_r(t, pTm)==0;#else  rc = localtime_s(pTm, t);#endif /* HAVE_LOCALTIME_R */#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */  return rc;}
开发者ID:1018824313,项目名称:sqlite,代码行数:40,


示例10: sqlite3MemInit

/*** Initialize the memory allocation subsystem.*/static int sqlite3MemInit(void *NotUsed){  if( !sqlite3Config.bMemstat ){    /* If memory status is enabled, then the malloc.c wrapper will already    ** hold the STATIC_MEM mutex when the routines here are invoked. */    mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  }  return SQLITE_OK;}
开发者ID:EmuxEvans,项目名称:sailing,代码行数:11,


示例11: sqlite3_vfs_unregister

/*** Unregister a VFS so that it is no longer accessible.*/int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){#if SQLITE_THREADSAFE  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif  sqlite3_mutex_enter(mutex);  vfsUnlink(pVfs);  sqlite3_mutex_leave(mutex);  return SQLITE_OK;}
开发者ID:Adoni,项目名称:WiEngine,代码行数:12,


示例12: sqlite3VdbeReleaseMemory

/*** Try to release n bytes of memory by freeing buffers associated ** with the memory registers of currently unused vdbes.*/int sqlite3VdbeReleaseMemory(int n){  Vdbe *p;  Vdbe *pNext;  int nFree = 0;  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));  for(p=sqlite3LruStatements.pFirst; p && nFree<n; p=pNext){    pNext = p->pLruNext;    /* For each statement handle in the lru list, attempt to obtain the    ** associated database mutex. If it cannot be obtained, continue    ** to the next statement handle. It is not possible to block on    ** the database mutex - that could cause deadlock.    */    if( SQLITE_OK==sqlite3_mutex_try(p->db->mutex) ){      nFree += sqlite3VdbeReleaseBuffers(p);      stmtLruRemoveNomutex(p);      sqlite3_mutex_leave(p->db->mutex);    }  }  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));  return nFree;}
开发者ID:shenjian74,项目名称:Bitcoin-History,代码行数:28,


示例13: sqlite3_reset_auto_extension

/*** Reset the automatic extension loading mechanism.*/void sqlite3_reset_auto_extension(void){#ifndef SQLITE_OMIT_AUTOINIT  if( sqlite3_initialize()==SQLITE_OK )#endif  {#ifndef SQLITE_MUTEX_NOOP    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif    sqlite3_mutex_enter(mutex);    sqlite3_free(autoext.aExt);    autoext.aExt = 0;    autoext.nExt = 0;    sqlite3_mutex_leave(mutex);  }}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:18,


示例14: sqlite3_reset_auto_extension

/* ** Reset the automatic extension loading mechanism. */SQLITE_API void sqlite3_reset_auto_extension(void){#ifndef SQLITE_OMIT_AUTOINIT    if( sqlite3_initialize()==SQLITE_OK )#endif    {#if SQLITE_THREADSAFE        sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif        wsdAutoextInit;        sqlite3_mutex_enter(mutex);        sqlite3_free(wsdAutoext.aExt);        wsdAutoext.aExt = 0;        wsdAutoext.nExt = 0;        sqlite3_mutex_leave(mutex);    }}
开发者ID:pchernev,项目名称:Objective-C-iOS-Categories,代码行数:19,


示例15: vfsUnlink

/*** Unlink a VFS from the linked list*/static void vfsUnlink(sqlite3_vfs *pVfs){  assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) );  if( pVfs==0 ){    /* No-op */  }else if( vfsList==pVfs ){    vfsList = pVfs->pNext;  }else if( vfsList ){    sqlite3_vfs *p = vfsList;    while( p->pNext && p->pNext!=pVfs ){      p = p->pNext;    }    if( p->pNext==pVfs ){      p->pNext = pVfs->pNext;    }  }}
开发者ID:Adoni,项目名称:WiEngine,代码行数:19,


示例16: sqlite3_cancel_auto_extension

/* ** Cancel a prior call to sqlite3_auto_extension.  Remove xInit from the ** set of routines that is invoked for each new database connection, if it ** is currently on the list.  If xInit is not on the list, then this ** routine is a no-op. ** ** Return 1 if xInit was found on the list and removed.  Return 0 if xInit ** was not on the list. */SQLITE_API int sqlite3_cancel_auto_extension(void (*xInit)(void)){#if SQLITE_THREADSAFE    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif    int i;    int n = 0;    wsdAutoextInit;    sqlite3_mutex_enter(mutex);    for(i=wsdAutoext.nExt-1; i>=0; i--){        if( wsdAutoext.aExt[i]==xInit ){            wsdAutoext.nExt--;            wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];            n++;            break;        }    }    sqlite3_mutex_leave(mutex);    return n;}
开发者ID:pchernev,项目名称:Objective-C-iOS-Categories,代码行数:28,


示例17: sqlite3_vfs_register

/*** Register a VFS with the system.  It is harmless to register the same** VFS multiple times.  The new VFS becomes the default if makeDflt is** true.*/int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){  sqlite3_mutex *mutex = 0;#ifndef SQLITE_OMIT_AUTOINIT  int rc = sqlite3_initialize();  if( rc ) return rc;#endif  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);  sqlite3_mutex_enter(mutex);  vfsUnlink(pVfs);  if( makeDflt || vfsList==0 ){    pVfs->pNext = vfsList;    vfsList = pVfs;  }else{    pVfs->pNext = vfsList->pNext;    vfsList->pNext = pVfs;  }  assert(vfsList);  sqlite3_mutex_leave(mutex);  return SQLITE_OK;}
开发者ID:Adoni,项目名称:WiEngine,代码行数:25,


示例18: sqlite3_initialize

/*** Locate a VFS by name.  If no name is given, simply return the** first VFS on the list.*/sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){  sqlite3_vfs *pVfs = 0;#if SQLITE_THREADSAFE  sqlite3_mutex *mutex;#endif#ifndef SQLITE_OMIT_AUTOINIT  int rc = sqlite3_initialize();  if( rc ) return 0;#endif#if SQLITE_THREADSAFE  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);#endif  sqlite3_mutex_enter(mutex);  for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){    if( zVfs==0 ) break;    if( strcmp(zVfs, pVfs->zName)==0 ) break;  }  sqlite3_mutex_leave(mutex);  return pVfs;}
开发者ID:Adoni,项目名称:WiEngine,代码行数:24,


示例19: sqlite3MallocInit

/*** Initialize the memory allocation subsystem.*/int sqlite3MallocInit(void){  if( sqlite3GlobalConfig.m.xMalloc==0 ){    sqlite3MemSetDefault();  }  memset(&mem0, 0, sizeof(mem0));  if( sqlite3GlobalConfig.bCoreMutex ){    mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  }  if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100      && sqlite3GlobalConfig.nScratch>=0 ){    int i;    sqlite3GlobalConfig.szScratch = (sqlite3GlobalConfig.szScratch - 4) & ~7;    mem0.aScratchFree = (u32*)&((char*)sqlite3GlobalConfig.pScratch)                  [sqlite3GlobalConfig.szScratch*sqlite3GlobalConfig.nScratch];    for(i=0; i<sqlite3GlobalConfig.nScratch; i++){ mem0.aScratchFree[i] = i; }    mem0.nScratchFree = sqlite3GlobalConfig.nScratch;  }else{    sqlite3GlobalConfig.pScratch = 0;    sqlite3GlobalConfig.szScratch = 0;  }  if( sqlite3GlobalConfig.pPage && sqlite3GlobalConfig.szPage>=512      && sqlite3GlobalConfig.nPage>=1 ){    int i;    int overhead;    int sz = sqlite3GlobalConfig.szPage & ~7;    int n = sqlite3GlobalConfig.nPage;    overhead = (4*n + sz - 1)/sz;    sqlite3GlobalConfig.nPage -= overhead;    mem0.aPageFree = (u32*)&((char*)sqlite3GlobalConfig.pPage)                  [sqlite3GlobalConfig.szPage*sqlite3GlobalConfig.nPage];    for(i=0; i<sqlite3GlobalConfig.nPage; i++){ mem0.aPageFree[i] = i; }    mem0.nPageFree = sqlite3GlobalConfig.nPage;  }else{    sqlite3GlobalConfig.pPage = 0;    sqlite3GlobalConfig.szPage = 0;  }  return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:41,


示例20: sqlite3MallocInit

/*** Initialize the memory allocation subsystem.*/int sqlite3MallocInit(void){  int rc;  if( sqlite3GlobalConfig.m.xMalloc==0 ){    sqlite3MemSetDefault();  }  memset(&mem0, 0, sizeof(mem0));  mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100      && sqlite3GlobalConfig.nScratch>0 ){    int i, n, sz;    ScratchFreeslot *pSlot;    sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch);    sqlite3GlobalConfig.szScratch = sz;    pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch;    n = sqlite3GlobalConfig.nScratch;    mem0.pScratchFree = pSlot;    mem0.nScratchFree = n;    for(i=0; i<n-1; i++){      pSlot->pNext = (ScratchFreeslot*)(sz+(char*)pSlot);      pSlot = pSlot->pNext;    }    pSlot->pNext = 0;    mem0.pScratchEnd = (void*)&pSlot[1];  }else{    mem0.pScratchEnd = 0;    sqlite3GlobalConfig.pScratch = 0;    sqlite3GlobalConfig.szScratch = 0;    sqlite3GlobalConfig.nScratch = 0;  }  if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512      || sqlite3GlobalConfig.nPage<=0 ){    sqlite3GlobalConfig.pPage = 0;    sqlite3GlobalConfig.szPage = 0;  }  rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);  if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));  return rc;}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:41,


示例21: memsys4Enter

/*** Enter the mutex mem.mutex. Allocate it if it is not already allocated.** The mmap() region is initialized the first time this routine is called.*/static void memsys4Enter(void){  if( mem.mutex==0 ){    mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  }  sqlite3_mutex_enter(mem.mutex);}
开发者ID:shenjian74,项目名称:Bitcoin-History,代码行数:10,


示例22: openDatabase

static int openDatabase(  const char *zFilename, /* Database filename UTF-8 encoded */  sqlite3 **ppDb,        /* OUT: Returned database handle */  unsigned int flags,    /* Operational flags */  const char *zVfs       /* Name of the VFS to use */){  sqlite3 *db;                    /* Store allocated handle here */  int rc;                         /* Return code */  int isThreadsafe;               /* True for threadsafe connections */  char *zOpen = 0;                /* Filename argument to pass to BtreeOpen() */  char *zErrMsg = 0;              /* Error message from sqlite3ParseUri() */#ifdef SQLITE_ENABLE_API_ARMOR  if( ppDb==0 ) return SQLITE_MISUSE_BKPT;#endif  *ppDb = 0;#ifndef SQLITE_OMIT_AUTOINIT  rc = sqlite3_initialize();  if( rc ) return rc;#endif  /* Only allow sensible combinations of bits in the flags argument.    ** Throw an error if any non-sense combination is used.  If we  ** do not block illegal combinations here, it could trigger  ** assert() statements in deeper layers.  Sensible combinations  ** are:  **  **  1:  SQLITE_OPEN_READONLY  **  2:  SQLITE_OPEN_READWRITE  **  6:  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE  */  assert( SQLITE_OPEN_READONLY  == 0x01 );  assert( SQLITE_OPEN_READWRITE == 0x02 );  assert( SQLITE_OPEN_CREATE    == 0x04 );  testcase( (1<<(flags&7))==0x02 ); /* READONLY */  testcase( (1<<(flags&7))==0x04 ); /* READWRITE */  testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */  if( ((1<<(flags&7)) & 0x46)==0 ){    return SQLITE_MISUSE_BKPT;  /* IMP: R-65497-44594 */  }  if( sqlite3GlobalConfig.bCoreMutex==0 ){    isThreadsafe = 0;  }else if( flags & SQLITE_OPEN_NOMUTEX ){    isThreadsafe = 0;  }else if( flags & SQLITE_OPEN_FULLMUTEX ){    isThreadsafe = 1;  }else{    isThreadsafe = sqlite3GlobalConfig.bFullMutex;  }  if( flags & SQLITE_OPEN_PRIVATECACHE ){    flags &= ~SQLITE_OPEN_SHAREDCACHE;  }else if( sqlite3GlobalConfig.sharedCacheEnabled ){    flags |= SQLITE_OPEN_SHAREDCACHE;  }  /* Remove harmful bits from the flags parameter  **  ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were  ** dealt with in the previous code block.  Besides these, the only  ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY,  ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE,  ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits.  Silently mask  ** off all other flags.  */  flags &=  ~( SQLITE_OPEN_DELETEONCLOSE |               SQLITE_OPEN_EXCLUSIVE |               SQLITE_OPEN_MAIN_DB |               SQLITE_OPEN_TEMP_DB |                SQLITE_OPEN_TRANSIENT_DB |                SQLITE_OPEN_MAIN_JOURNAL |                SQLITE_OPEN_TEMP_JOURNAL |                SQLITE_OPEN_SUBJOURNAL |                SQLITE_OPEN_MASTER_JOURNAL |               SQLITE_OPEN_NOMUTEX |               SQLITE_OPEN_FULLMUTEX |               SQLITE_OPEN_WAL             );  /* Allocate the sqlite data structure */  db = sqlite3MallocZero( sizeof(sqlite3) );  if( db==0 ) goto opendb_out;  if( isThreadsafe ){    db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);    if( db->mutex==0 ){      sqlite3_free(db);      db = 0;      goto opendb_out;    }  }  sqlite3_mutex_enter(db->mutex);  db->errMask = 0xff;  db->nDb = 2;  db->magic = SQLITE_MAGIC_BUSY;  db->aDb = db->aDbStatic;  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));  db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;  db->autoCommit = 1;//.........这里部分代码省略.........
开发者ID:baya,项目名称:sqlite3-debug,代码行数:101,


示例23: enterMutex

/*** Obtain the STATIC_MASTER mutex.*/static void enterMutex(void){  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));  checkListProperties(0);}
开发者ID:1018824313,项目名称:sqlite,代码行数:7,


示例24: leaveMutex

/*** Release the STATIC_MASTER mutex.*/static void leaveMutex(void){  assertMutexHeld();  checkListProperties(0);  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));}
开发者ID:1018824313,项目名称:sqlite,代码行数:8,


示例25: memsys3Enter

/*** If the STATIC_MEM mutex is not already held, obtain it now. The mutex** will already be held (obtained by code in malloc.c) if** sqlite3GlobalConfig.bMemStat is true.*/static void memsys3Enter(void){  if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){    mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  }  sqlite3_mutex_enter(mem3.mutex);}
开发者ID:7kbird,项目名称:chrome,代码行数:11,


示例26: stmtLruRemove

/*** Assuming the SQLITE_MUTEX_STATIC_LRU2 mutext is not held, remove** statement p from the least-recently-used statement list. If the ** statement is not currently part of the list, this call is a no-op.*/static void stmtLruRemove(Vdbe *p){  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));  stmtLruRemoveNomutex(p);  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));}
开发者ID:shenjian74,项目名称:Bitcoin-History,代码行数:10,


示例27: memsys3Enter

//该函数用于获取互斥锁,通过sqlite3GlobalConfig.bMemstat的值来判断是否已经获取static void memsys3Enter(void) {    if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ) { //判断是否已经获得互斥锁        mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);//获取互斥锁    }    sqlite3_mutex_enter(mem3.mutex);     //加锁}
开发者ID:wangyw09,项目名称:Sqlite3.07.14,代码行数:7,



注:本文中的sqlite3MutexAlloc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sqlite3NameFromToken函数代码示例
C++ sqlite3MallocSize函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。