1 /*-------------------------------------------------------------------------
4 * Lightweight lock manager
7 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.24 2005/12/11 21:02:18 tgl Exp $
12 *-------------------------------------------------------------------------
18 * We have a number of predefined LWLocks, plus a bunch of LWLocks that are
19 * dynamically assigned (e.g., for shared buffers). The LWLock structures
20 * live in shared memory (since they contain shared data) and are identified
21 * by values of this enumerated type. We abuse the notion of an enum somewhat
22 * by allowing values not listed in the enum declaration to be assigned.
23 * The extra value MaxDynamicLWLock is there to keep the compiler from
24 * deciding that the enum can be represented as char or short ...
43 MultiXactOffsetControlLock,
44 MultiXactMemberControlLock,
48 FirstLockMgrLock, /* must be last except for MaxDynamicLWLock */
50 MaxDynamicLWLock = 1000000000
54 typedef enum LWLockMode
62 extern bool Trace_lwlocks;
65 extern LWLockId LWLockAssign(void);
66 extern void LWLockAcquire(LWLockId lockid, LWLockMode mode);
67 extern bool LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode);
68 extern void LWLockRelease(LWLockId lockid);
69 extern void LWLockReleaseAll(void);
70 extern bool LWLockHeldByMe(LWLockId lockid);
72 extern int NumLWLocks(void);
73 extern Size LWLockShmemSize(void);
74 extern void CreateLWLocks(void);