LMDB
Macros
Compatibility Macros

Macros

#define MDB_DEVEL   0
 
#define mdb_func_   "<mdb_unknown>"
 
#define THREAD_RET   void *
 
#define THREAD_CREATE(thr, start, arg)   pthread_create(&thr,NULL,start,arg)
 
#define THREAD_FINISH(thr)   pthread_join(thr,NULL)
 
#define Z   "z"
 
#define MDB_PIDLOCK   1
 
#define LOCK_MUTEX_R(env)   pthread_mutex_lock(&(env)->me_txns->mti_mutex)
 
#define UNLOCK_MUTEX_R(env)   pthread_mutex_unlock(&(env)->me_txns->mti_mutex)
 
#define LOCK_MUTEX_W(env)   pthread_mutex_lock(&(env)->me_txns->mti_wmutex)
 
#define UNLOCK_MUTEX_W(env)   pthread_mutex_unlock(&(env)->me_txns->mti_wmutex)
 
#define ErrCode()   errno
 
#define HANDLE   int
 
#define INVALID_HANDLE_VALUE   (-1)
 
#define GET_PAGESIZE(x)   ((x) = sysconf(_SC_PAGE_SIZE))
 
#define MNAME_LEN   (sizeof(pthread_mutex_t))
 

Detailed Description

A bunch of macros to minimize the amount of platform-specific ifdefs needed throughout the rest of the code. When the features this library needs are similar enough to POSIX to be hidden in a one-or-two line replacement, this macro approach is used.

Macro Definition Documentation

#define MDB_DEVEL   0

Features under development

#define mdb_func_   "<mdb_unknown>"

Wrapper around func, which is a C99 feature

#define Z   "z"

printf format modifier for size_t

#define MDB_PIDLOCK   1

For MDB_LOCK_FORMAT: True if readers take a pid lock in the lockfile

#define LOCK_MUTEX_R (   env)    pthread_mutex_lock(&(env)->me_txns->mti_mutex)

Lock the reader mutex.

#define UNLOCK_MUTEX_R (   env)    pthread_mutex_unlock(&(env)->me_txns->mti_mutex)

Unlock the reader mutex.

#define LOCK_MUTEX_W (   env)    pthread_mutex_lock(&(env)->me_txns->mti_wmutex)

Lock the writer mutex. Only a single write transaction is allowed at a time. Other writers will block waiting for this mutex.

#define UNLOCK_MUTEX_W (   env)    pthread_mutex_unlock(&(env)->me_txns->mti_wmutex)

Unlock the writer mutex.

#define ErrCode ( )    errno

Get the error code for the last failed system function.

#define HANDLE   int

An abstraction for a file handle. On POSIX systems file handles are small integers. On Windows they're opaque pointers.

#define INVALID_HANDLE_VALUE   (-1)

A value for an invalid file handle. Mainly used to initialize file variables and signify that they are unused.

#define GET_PAGESIZE (   x)    ((x) = sysconf(_SC_PAGE_SIZE))

Get the size of a memory page for the system. This is the basic size that the platform's memory manager uses, and is fundamental to the use of memory-mapped files.