PostgreSQL Source Code  git master
procnumber.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * procnumber.h
4  * definition of process number
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/storage/procnumber.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PROCNUMBER_H
15 #define PROCNUMBER_H
16 
17 /*
18  * ProcNumber uniquely identifies an active backend or auxiliary process.
19  * It's assigned at backend startup after authentication, when the process
20  * adds itself to the proc array. It is an index into the proc array,
21  * starting from 0. Note that a ProcNumber can be reused for a different
22  * backend immediately after a backend exits.
23  */
24 typedef int ProcNumber;
25 
26 #define INVALID_PROC_NUMBER (-1)
27 
28 /*
29  * Proc number of this backend (same as GetNumberFromPGProc(MyProc))
30  */
32 
33 /* proc number of our parallel session leader, or INVALID_PROC_NUMBER if none */
35 
36 /*
37  * The ProcNumber to use for our session's temp relations is normally our own,
38  * but parallel workers should use their leader's proc number.
39  */
40 #define ProcNumberForTempRelations() \
41  (ParallelLeaderProcNumber == INVALID_PROC_NUMBER ? MyProcNumber : ParallelLeaderProcNumber)
42 
43 #endif /* PROCNUMBER_H */
#define PGDLLIMPORT
Definition: c.h:1316
int ProcNumber
Definition: procnumber.h:24
PGDLLIMPORT ProcNumber ParallelLeaderProcNumber
Definition: globals.c:89
PGDLLIMPORT ProcNumber MyProcNumber
Definition: globals.c:87