mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
4db3744f1f
This code is intended as a demonstration of how the dynamic shared memory and dynamic background worker facilities can be used to establish a group of coooperating processes which can coordinate their activities using the shared memory message queue facility. By itself, the code does nothing particularly interesting: it simply allows messages to be passed through a loop of workers and back to the original process. But it's a useful unit test, in addition to its demonstration value.
20 lines
752 B
SQL
20 lines
752 B
SQL
/* contrib/test_shm_mq/test_shm_mq--1.0.sql */
|
|
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
\echo Use "CREATE EXTENSION test_shm_mq" to load this file. \quit
|
|
|
|
CREATE FUNCTION test_shm_mq(queue_size pg_catalog.int8,
|
|
message pg_catalog.text,
|
|
repeat_count pg_catalog.int4 default 1,
|
|
num_workers pg_catalog.int4 default 1)
|
|
RETURNS pg_catalog.void STRICT
|
|
AS 'MODULE_PATHNAME' LANGUAGE C;
|
|
|
|
CREATE FUNCTION test_shm_mq_pipelined(queue_size pg_catalog.int8,
|
|
message pg_catalog.text,
|
|
repeat_count pg_catalog.int4 default 1,
|
|
num_workers pg_catalog.int4 default 1,
|
|
verify pg_catalog.bool default true)
|
|
RETURNS pg_catalog.void STRICT
|
|
AS 'MODULE_PATHNAME' LANGUAGE C;
|