mutex.h

Go to the documentation of this file.
00001 /*
00002 ** 2007 August 28
00003 **
00004 ** The author disclaims copyright to this source code.  In place of
00005 ** a legal notice, here is a blessing:
00006 **
00007 **    May you do good and not evil.
00008 **    May you find forgiveness for yourself and forgive others.
00009 **    May you share freely, never taking more than you give.
00010 **
00011 *************************************************************************
00012 **
00013 ** This file contains the common header for all mutex implementations.
00014 ** The sqliteInt.h header #includes this file so that it is available
00015 ** to all source files.  We break it out in an effort to keep the code
00016 ** better organized.
00017 **
00018 ** NOTE:  source files should *not* #include this header file directly.
00019 ** Source files should #include the sqliteInt.h file and let that file
00020 ** include this one indirectly.
00021 **
00022 ** $Id: mutex.h,v 1.9 2008/10/07 15:25:48 drh Exp $
00023 */
00024 
00025 
00026 /*
00027 ** Figure out what version of the code to use.  The choices are
00028 **
00029 **   SQLITE_MUTEX_OMIT         No mutex logic.  Not even stubs.  The
00030 **                             mutexes implemention cannot be overridden
00031 **                             at start-time.
00032 **
00033 **   SQLITE_MUTEX_NOOP         For single-threaded applications.  No
00034 **                             mutual exclusion is provided.  But this
00035 **                             implementation can be overridden at
00036 **                             start-time.
00037 **
00038 **   SQLITE_MUTEX_PTHREADS     For multi-threaded applications on Unix.
00039 **
00040 **   SQLITE_MUTEX_W32          For multi-threaded applications on Win32.
00041 **
00042 **   SQLITE_MUTEX_OS2          For multi-threaded applications on OS/2.
00043 */
00044 #if !SQLITE_THREADSAFE
00045 # define SQLITE_MUTEX_OMIT
00046 #endif
00047 #if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP)
00048 #  if SQLITE_OS_UNIX
00049 #    define SQLITE_MUTEX_PTHREADS
00050 #  elif SQLITE_OS_WIN
00051 #    define SQLITE_MUTEX_W32
00052 #  elif SQLITE_OS_OS2
00053 #    define SQLITE_MUTEX_OS2
00054 #  else
00055 #    define SQLITE_MUTEX_NOOP
00056 #  endif
00057 #endif
00058 
00059 #ifdef SQLITE_MUTEX_OMIT
00060 /*
00061 ** If this is a no-op implementation, implement everything as macros.
00062 */
00063 #define sqlite3_mutex_alloc(X)    ((sqlite3_mutex*)8)
00064 #define sqlite3_mutex_free(X)
00065 #define sqlite3_mutex_enter(X)
00066 #define sqlite3_mutex_try(X)      SQLITE_OK
00067 #define sqlite3_mutex_leave(X)
00068 #define sqlite3_mutex_held(X)     1
00069 #define sqlite3_mutex_notheld(X)  1
00070 #define sqlite3MutexAlloc(X)      ((sqlite3_mutex*)8)
00071 #define sqlite3MutexInit()        SQLITE_OK
00072 #define sqlite3MutexEnd()
00073 #endif /* defined(SQLITE_OMIT_MUTEX) */

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:55 2011 by Doxygen 1.6.1