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.17 2005/03/04 20:21:07 tgl Exp $
12 *-------------------------------------------------------------------------
18 * We have a number of predefined LWLocks, plus a bunch of LWLocks that are
19 * dynamically assigned (for shared buffers). The LWLock structures live
20 * in shared memory (since they contain shared data) and are identified by
21 * 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 ...
46 NumFixedLWLocks, /* must be last except for
49 MaxDynamicLWLock = 1000000000
53 typedef enum LWLockMode
61 extern bool Trace_lwlocks;
64 extern LWLockId LWLockAssign(void);
65 extern void LWLockAcquire(LWLockId lockid, LWLockMode mode);
66 extern bool LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode);
67 extern void LWLockRelease(LWLockId lockid);
68 extern void LWLockReleaseAll(void);
69 extern bool LWLockHeldByMe(LWLockId lockid);
71 extern int NumLWLocks(void);
72 extern int LWLockShmemSize(void);
73 extern void CreateLWLocks(void);