From: | Steven Bradley <sbradley(at)llnl(dot)gov> |
---|---|
To: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | Inter-process communication |
Date: | 1999-06-26 00:27:35 |
Message-ID: | 3.0.5.32.19990625172735.009266d0@poptop.llnl.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
I would like to use the LISTEN and NOTIFY features of Postgres to implement
communication between to proceses connected to Postgres, but I don't want
to "listening" process to use polling to detect notifications. The
following polling example is given in the Postgres documentation:
while (1)
{
/*
* wait a little bit between checks; waiting with select()
* would be more efficient.
*/
sleep(1);
/* collect any asynchronous backend messages */
PQconsumeInput(conn);
/* check for asynchronous notify messages */
while ((notify = PQnotifies(conn)) != NULL)
{
fprintf(stderr,
"ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
notify->relname, notify->be_pid);
free(notify);
}
}
Instead, I would rather use the "more efficient select(2)" method alluded
to in the Postgres documentation (and code above). Does anyone have
sample code that uses this method to wait for a backend notification to
arrive?
Thanks in advance...
Steven Bradley
Lawrence Livermore National Laboratory
sbradley(at)llnl(dot)gov
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 1999-06-26 10:41:42 | Re: [INTERFACES] ARC/Info and Intergraph |
Previous Message | PostgreSQL Admin | 1999-06-25 19:45:07 | libpq, Large Objects, Type lo |