summaryrefslogtreecommitdiff
path: root/src/include/gtm/gtm_common.h
blob: 35f4ba6c5f09de06226063cd4236f1b6ee9de850 (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
42
43
44
45
46
47
48
49
/*
 *
 * gtm_common.h
 *
 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 * Portions Copyright (c) 2010-2012 Postgres-XC Development Group
 * Portions Copyright (c) 2014 Translattice Inc
 *
 * $PostgreSQL$
 *
 *-------------------------------------------------------------------------
 */

#ifndef _GTM_COMMON_H
#define _GTM_COMMON_H

/*
 * We expect a very small number of concurrent locks, except for some cases
 * where a thread may try to acquire thr_lock of all other threads. So keep the
 * value relatively high.
 *
 * If you change GTM_MAX_THREADS, consider changing this too.
 */
#define GTM_MAX_SIMUL_RWLOCKS	(1024 + 32)
#define GTM_MAX_SIMUL_MUTEX		(32)

#define GTM_COMMON_THREAD_INFO \
	GTM_ThreadID			thr_id; \
	uint32					thr_localid; \
	bool					is_main_thread; \
	void * (* thr_startroutine)(void *); \
	MemoryContext	thr_thread_context; \
	MemoryContext	thr_message_context; \
	MemoryContext	thr_current_context; \
	MemoryContext	thr_error_context; \
	MemoryContext	thr_parent_context; \
	sigjmp_buf		*thr_sigjmp_buf; \
	ErrorData		thr_error_data[ERRORDATA_STACK_SIZE]; \
	int				thr_error_stack_depth; \
	int				thr_error_recursion_depth; \
	int				thr_criticalsec_count;	\
	int				thr_num_rwlocks_held;	\
	GTM_RWLock		*thr_rwlocks_held[GTM_MAX_SIMUL_RWLOCKS];	\
	int				thr_num_mutexlocks_held;	\
	GTM_MutexLock	*thr_mutexlocks_held[GTM_MAX_SIMUL_MUTEX];


#endif