pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Support condition variables.
Date: Tue, 22 Nov 2016 19:28:42 +0000
Message-ID: <E1c9GkE-0001hX-Ff@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Support condition variables.

Condition variables provide a flexible way to sleep until a
cooperating process causes an arbitrary condition to become true.  In
simple cases, this can be accomplished with a WaitLatch/ResetLatch
loop; the cooperating process can call SetLatch after performing work
that might cause the condition to be satisfied, and the waiting
process can recheck the condition each time.  However, if the process
performing the work doesn't have an easy way to identify which
processes might be waiting, this doesn't work, because it can't
identify which latches to set.  Condition variables solve that problem
by internally maintaining a list of waiters; a process that may have
caused some waiter's condition to be satisfied must "signal" or
"broadcast" on the condition variable.

Robert Haas and Thomas Munro

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e8ac886c24776295dd9b025386a821061da8e4d1

Modified Files
--------------
src/backend/access/transam/xact.c             |   4 +
src/backend/bootstrap/bootstrap.c             |   2 +
src/backend/postmaster/bgwriter.c             |   2 +
src/backend/postmaster/checkpointer.c         |   2 +
src/backend/postmaster/walwriter.c            |   2 +
src/backend/replication/walsender.c           |   2 +
src/backend/storage/lmgr/Makefile             |   2 +-
src/backend/storage/lmgr/condition_variable.c | 225 ++++++++++++++++++++++++++
src/backend/storage/lmgr/proc.c               |   7 +
src/include/storage/condition_variable.h      |  59 +++++++
src/include/storage/proc.h                    |   3 +
src/include/storage/proclist.h                |  56 ++++++-
12 files changed, 364 insertions(+), 2 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1c9GkE-0001hX-Ff@gemulon.postgresql.org>
Permalink:  ../E1c9GkE-0001hX-Ff@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1c9GkE-0001hX-Ff@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Support condition variables.
  In-Reply-To: <E1c9GkE-0001hX-Ff@gemulon.postgresql.org>
  References: <E1c9GkE-0001hX-Ff@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox