engine/sqlite/src/mutex.h
author Sebastian Brannstrom <sebastianb@symbian.org>
Sat, 23 Oct 2010 16:26:37 +0100
branchsymbian1
changeset 270 8d5c0f720979
parent 2 29cda98b007e
permissions -rw-r--r--
Updated SIS v 1.00.31
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
** 2007 August 28
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
** The author disclaims copyright to this source code.  In place of
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
** a legal notice, here is a blessing:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
**    May you do good and not evil.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
**    May you find forgiveness for yourself and forgive others.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
**    May you share freely, never taking more than you give.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
*************************************************************************
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
** This file contains the common header for all mutex implementations.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
** The sqliteInt.h header #includes this file so that it is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
** to all source files.  We break it out in an effort to keep the code
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
** better organized.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
** NOTE:  source files should *not* #include this header file directly.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
** Source files should #include the sqliteInt.h file and let that file
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
** include this one indirectly.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
** $Id: mutex.h 1282 2008-11-13 09:31:33Z LarsPson $
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#ifdef SQLITE_MUTEX_APPDEF
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
** If SQLITE_MUTEX_APPDEF is defined, then this whole module is
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
** omitted and equivalent functionality must be provided by the
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
** application that links against the SQLite library.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
** Figure out what version of the code to use.  The choices are
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
**   SQLITE_MUTEX_NOOP         For single-threaded applications that
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
**                             do not desire error checking.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
**   SQLITE_MUTEX_NOOP_DEBUG   For single-threaded applications with
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
**                             error checking to help verify that mutexes
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
**                             are being used correctly even though they
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
**                             are not needed.  Used when SQLITE_DEBUG is
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
**                             defined on single-threaded builds.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
**   SQLITE_MUTEX_PTHREADS     For multi-threaded applications on Unix.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
**   SQLITE_MUTEX_W32          For multi-threaded applications on Win32.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
**   SQLITE_MUTEX_OS2          For multi-threaded applications on OS/2.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
#define SQLITE_MUTEX_NOOP 1   /* The default */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
#if defined(SQLITE_DEBUG) && !SQLITE_THREADSAFE
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
# undef SQLITE_MUTEX_NOOP
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
# define SQLITE_MUTEX_NOOP_DEBUG
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
#if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && OS_UNIX
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
# undef SQLITE_MUTEX_NOOP
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
# define SQLITE_MUTEX_PTHREADS
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
#if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && OS_WIN
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
# undef SQLITE_MUTEX_NOOP
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
# define SQLITE_MUTEX_W32
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
#if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && OS_OS2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
# undef SQLITE_MUTEX_NOOP
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
# define SQLITE_MUTEX_OS2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
#ifdef SQLITE_MUTEX_NOOP
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
** If this is a no-op implementation, implement everything as macros.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
#define sqlite3_mutex_alloc(X)    ((sqlite3_mutex*)8)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
#define sqlite3_mutex_free(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
#define sqlite3_mutex_enter(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
#define sqlite3_mutex_try(X)      SQLITE_OK
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
#define sqlite3_mutex_leave(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
#define sqlite3_mutex_held(X)     1
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
#define sqlite3_mutex_notheld(X)  1
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
#endif /* SQLITE_MUTEX_APPDEF */