mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 02:43:03 +01:00
Macro cleaning
This commit is contained in:
parent
75753014cc
commit
78bdd28196
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
$Id: lock.cpp,v 1.98 2004-05-17 10:17:25 brodsom Exp $
|
||||
$Id: lock.cpp,v 1.99 2004-05-17 15:14:09 brodsom Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
@ -95,6 +95,8 @@ $Id: lock.cpp,v 1.98 2004-05-17 10:17:25 brodsom Exp $
|
||||
#ifdef WIN_NT
|
||||
#include <process.h>
|
||||
#define MUTEX lock_manager_mutex
|
||||
#else
|
||||
#define MUTEX LOCK_header->lhb_mutex
|
||||
#endif
|
||||
|
||||
#ifdef MANAGER_PROCESS
|
||||
@ -110,31 +112,16 @@ static bool LOCK_post_manager;
|
||||
#define VALIDATE_LOCK_TABLE
|
||||
#if ((defined HAVE_MMAP) && !(defined SUPERSERVER))
|
||||
#define LOCK_DEBUG_ACQUIRE
|
||||
#endif
|
||||
//#define DEBUG_TRACE
|
||||
#endif
|
||||
|
||||
#ifdef LOCK_DEBUG_ACQUIRE
|
||||
#define DEBUG_ACQUIRE_INTERVAL 5000
|
||||
static ULONG debug_acquire_count = 0;
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT_ACQUIRED
|
||||
#define ASSERT_ACQUIRED /* nothing */
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT_RELEASED
|
||||
#define ASSERT_RELEASED /* nothing */
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
#define CHECK(x) { if (!(x)) bug_assert ("consistency check", __LINE__); }
|
||||
#endif
|
||||
|
||||
#ifndef CHECK
|
||||
//#define DEBUG_TRACE
|
||||
#else // DEV_BUILD
|
||||
#define ASSERT_ACQUIRED /* nothing */
|
||||
#define ASSERT_RELEASED /* nothing */
|
||||
#define CHECK(x) /* nothing */
|
||||
#endif
|
||||
#endif // DEV_BUILD
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_MANAGER "manager"
|
||||
@ -143,40 +130,30 @@ static ULONG debug_acquire_count = 0;
|
||||
|
||||
#ifdef DEBUG_TRACE
|
||||
#define LOCK_TRACE(x) { time_t t; time(&t); printf("%s", ctime(&t) ); printf x; fflush (stdout); gds__log x;}
|
||||
#else
|
||||
#define LOCK_TRACE(x) /* nothing */
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
SSHORT LOCK_debug_level = 0;
|
||||
#define DEBUG_MSG(l,x) if ((l) <= LOCK_debug_level) { time_t t; time(&t); printf("%s", ctime(&t) ); printf x; fflush (stdout); gds__log x; }
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_MSG
|
||||
#else
|
||||
#define DEBUG_MSG(l,x) /* nothing */
|
||||
#endif
|
||||
|
||||
#ifndef LOCK_TRACE
|
||||
#define LOCK_TRACE(x) /* nothing */
|
||||
#endif
|
||||
|
||||
/* Debug delay is used to create nice big windows for signals or other
|
||||
* events to occur in - eg: slow down the code to try and make
|
||||
* timing race conditions show up
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_DELAY debug_delay (__LINE__)
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_DELAY
|
||||
#else
|
||||
#define DEBUG_DELAY /* nothing */
|
||||
#endif
|
||||
|
||||
#ifndef MUTEX
|
||||
#define MUTEX LOCK_header->lhb_mutex
|
||||
#endif
|
||||
|
||||
#define DUMMY_OWNER_CREATE ((SRQ_PTR) -1)
|
||||
#define DUMMY_OWNER_DELETE ((SRQ_PTR) -2)
|
||||
#define DUMMY_OWNER_SHUTDOWN ((SRQ_PTR) -3)
|
||||
const SRQ_PTR DUMMY_OWNER_CREATE = -1;
|
||||
const SRQ_PTR DUMMY_OWNER_DELETE = -2;
|
||||
const SRQ_PTR DUMMY_OWNER_SHUTDOWN = -3;
|
||||
|
||||
static void acquire(SRQ_PTR);
|
||||
static UCHAR *alloc(SSHORT, ISC_STATUS *);
|
||||
@ -299,26 +276,23 @@ static HANDLE wakeup_event[1];
|
||||
|
||||
#define GET_TIME time (NULL)
|
||||
|
||||
#define HASH_MIN_SLOTS 101
|
||||
#define HASH_MAX_SLOTS 2048
|
||||
#define HISTORY_BLOCKS 256
|
||||
#define LOCKMANTIMEOUT 300
|
||||
const SLONG HASH_MIN_SLOTS = 101;
|
||||
const SLONG HASH_MAX_SLOTS = 2048;
|
||||
const USHORT HISTORY_BLOCKS = 256;
|
||||
const int LOCKMANTIMEOUT = 300;
|
||||
|
||||
#if (defined SOLARIS_MT && !defined SUPERSERVER)
|
||||
#define STARVATION_THRESHHOLD 500 /* acquires of lock table */
|
||||
#define SOLARIS_MIN_STALL 0
|
||||
#define SOLARIS_MAX_STALL 200
|
||||
#define SOLARIS_MAX_STALL 200 /* Seconds */
|
||||
const int STARVATION_THRESHHOLD = 500; /* acquires of lock table */
|
||||
const SLONG SOLARIS_MIN_STALL = 0;
|
||||
const SLONG SOLARIS_MAX_STALL = 200;
|
||||
const SLONG SOLARIS_MAX_STALL = 200; /* Seconds */
|
||||
#endif
|
||||
|
||||
#define OWN_BLOCK_new 1
|
||||
#define OWN_BLOCK_reused 2
|
||||
#define OWN_BLOCK_dummy 3
|
||||
|
||||
#ifndef LOCK_MANAGER
|
||||
#define LOCK_MANAGER "bin/fb_lock_mgr"
|
||||
#endif
|
||||
const USHORT OWN_BLOCK_new = 1;
|
||||
const USHORT OWN_BLOCK_reused = 2;
|
||||
const USHORT OWN_BLOCK_dummy = 3;
|
||||
|
||||
const char* LOCK_MANAGER = "bin/fb_lock_mgr";
|
||||
|
||||
#if defined WIN_NT && defined USE_BLOCKING_THREAD
|
||||
static HANDLE blocking_action_thread_handle;
|
||||
@ -4250,11 +4224,11 @@ static int signal_owner( OWN blocking_owner, SRQ_PTR blocked_owner_offset)
|
||||
#ifdef VALIDATE_LOCK_TABLE
|
||||
|
||||
|
||||
#define EXPECT_inuse 0
|
||||
#define EXPECT_freed 1
|
||||
const USHORT EXPECT_inuse = 0;
|
||||
const USHORT EXPECT_freed = 1;
|
||||
|
||||
#define RECURSE_yes 0
|
||||
#define RECURSE_not 1
|
||||
const USHORT RECURSE_yes = 0;
|
||||
const USHORT RECURSE_not = 1;
|
||||
|
||||
static void validate_history( SRQ_PTR history_header)
|
||||
{
|
||||
|
@ -123,16 +123,16 @@ const int type_own = 8;
|
||||
|
||||
const int type_MAX = type_own;
|
||||
|
||||
#define CLASSIC_LHB_VERSION 15 // Firebird 1.5
|
||||
#define SS_LHB_VERSION (CLASSIC_LHB_VERSION + 100)
|
||||
const int CLASSIC_LHB_VERSION = 15; // Firebird 1.5
|
||||
const int SS_LHB_VERSION = CLASSIC_LHB_VERSION + 100;
|
||||
|
||||
#ifdef SUPERSERVER
|
||||
#define LHB_VERSION SS_LHB_VERSION
|
||||
const int LHB_VERSION = SS_LHB_VERSION;
|
||||
#else
|
||||
#define LHB_VERSION CLASSIC_LHB_VERSION
|
||||
const int LHB_VERSION = CLASSIC_LHB_VERSION;
|
||||
#endif
|
||||
|
||||
#define LHB_PATTERN 123454321
|
||||
const SLONG LHB_PATTERN = 123454321;
|
||||
|
||||
//
|
||||
// Define methods that lock manager uses to handle events
|
||||
@ -209,8 +209,9 @@ typedef struct lhb {
|
||||
srq lhb_hash[1]; /* Hash table */
|
||||
} *LHB;
|
||||
|
||||
#define LHB_lock_ordering 1 /* Lock ordering is enabled */
|
||||
#define LHB_shut_manager 2 /* Lock manager shutdown flag */
|
||||
// lhb_flags
|
||||
const USHORT LHB_lock_ordering = 1; /* Lock ordering is enabled */
|
||||
const USHORT LHB_shut_manager = 2; /* Lock manager shutdown flag */
|
||||
|
||||
/* Secondary header block -- exists only in V3.3 and later lock
|
||||
managers. It is pointed to by the word in the lhb that used to contain
|
||||
|
@ -65,10 +65,10 @@
|
||||
|
||||
typedef FILE* OUTFILE;
|
||||
|
||||
#define SW_I_ACQUIRE 1
|
||||
#define SW_I_OPERATION 2
|
||||
#define SW_I_TYPE 4
|
||||
#define SW_I_WAIT 8
|
||||
const USHORT SW_I_ACQUIRE = 1;
|
||||
const USHORT SW_I_OPERATION = 2;
|
||||
const USHORT SW_I_TYPE = 4;
|
||||
const USHORT SW_I_WAIT = 8;
|
||||
|
||||
#define SRQ_BASE ((UCHAR*) LOCK_header)
|
||||
|
||||
@ -1115,9 +1115,9 @@ static void prt_owner_wait_cycle(
|
||||
if (owner_request == lock_request)
|
||||
break;
|
||||
|
||||
if (COMPATIBLE(owner_request->lrq_requested,
|
||||
MAX(lock_request->lrq_state,
|
||||
lock_request->lrq_requested))) continue;
|
||||
if (COMPATIBLE(owner_request->lrq_requested, MAX(lock_request->lrq_state,
|
||||
lock_request->lrq_requested)))
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1125,9 +1125,8 @@ static void prt_owner_wait_cycle(
|
||||
if (lock_request == owner_request)
|
||||
continue;
|
||||
|
||||
if (COMPATIBLE
|
||||
(owner_request->lrq_requested,
|
||||
lock_request->lrq_state)) continue;
|
||||
if (COMPATIBLE(owner_request->lrq_requested, lock_request->lrq_state))
|
||||
continue;
|
||||
};
|
||||
const own* lock_owner = (OWN) SRQ_ABS_PTR(lock_request->lrq_owner);
|
||||
prt_owner_wait_cycle(outfile, LOCK_header, lock_owner, indent + 4,
|
||||
|
Loading…
Reference in New Issue
Block a user