1/*-------------------------------------------------------------------------
2 *
3 * backendid.h
4 * POSTGRES backend id communication definitions
5 *
6 *
7 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/storage/backendid.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef BACKENDID_H
15#define BACKENDID_H
16
17/* ----------------
18 * -cim 8/17/90
19 * ----------------
20 */
21typedef int BackendId; /* unique currently active backend identifier */
22
23#define InvalidBackendId (-1)
24
25extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */
26
27/* backend id of our parallel session leader, or InvalidBackendId if none */
28extern PGDLLIMPORT BackendId ParallelMasterBackendId;
29
30/*
31 * The BackendId to use for our session's temp relations is normally our own,
32 * but parallel workers should use their leader's ID.
33 */
34#define BackendIdForTempRelations() \
35 (ParallelMasterBackendId == InvalidBackendId ? MyBackendId : ParallelMasterBackendId)
36
37#endif /* BACKENDID_H */
38