summaryrefslogtreecommitdiff
path: root/src/include/storage/spin.h
blob: 7faa19b64a50af8ffd3a6555c0dfa5dfe93aa0e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*-------------------------------------------------------------------------
 *
 * spin.h
 *	  synchronization routines
 *
 *
 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * $Id: spin.h,v 1.14 2001/01/24 19:43:28 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef SPIN_H
#define SPIN_H

#include "storage/ipc.h"

/*
 * two implementations of spin locks
 *
 * Where TAS instruction is available: real spin locks.
 * See src/storage/ipc/s_lock.c for details.
 *
 * Otherwise: fake spin locks using semaphores.  see spin.c
 */

typedef int SPINLOCK;

#ifdef LOCK_DEBUG
extern bool Trace_spinlocks;
#endif


extern int	SLockShmemSize(void);
extern void CreateSpinlocks(PGShmemHeader *seghdr);

extern void SpinAcquire(SPINLOCK lockid);
extern void SpinRelease(SPINLOCK lockid);

#endif	 /* SPIN_H */