* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.124 2005/08/20 00:39:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.125 2005/10/06 21:30:32 neilc Exp $
*
*-------------------------------------------------------------------------
*/
* Actual notification happens during transaction commit.
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
- * Results:
- * XXX
- *
*--------------------------------------------------------------
*/
void
-Async_Notify(char *relname)
+Async_Notify(const char *relname)
{
if (Trace_notify)
elog(DEBUG1, "Async_Notify(%s)", relname);
*
* This is executed by the SQL listen command.
*
- * Register a backend (identified by its Unix PID) as listening
- * on the specified relation.
- *
- * Results:
- * XXX
+ * Register the current backend as listening on the specified
+ * relation.
*
* Side effects:
* pg_listener is updated.
*--------------------------------------------------------------
*/
void
-Async_Listen(char *relname, int pid)
+Async_Listen(const char *relname)
{
Relation lRel;
HeapScanDesc scan;
bool alreadyListener = false;
if (Trace_notify)
- elog(DEBUG1, "Async_Listen(%s,%d)", relname, pid);
+ elog(DEBUG1, "Async_Listen(%s,%d)", relname, MyProcPid);
lRel = heap_open(ListenerRelationId, ExclusiveLock);
{
Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(tuple);
- if (listener->listenerpid == pid &&
+ if (listener->listenerpid == MyProcPid &&
strncmp(NameStr(listener->relname), relname, NAMEDATALEN) == 0)
{
alreadyListener = true;
i = 0;
values[i++] = (Datum) relname;
- values[i++] = (Datum) pid;
+ values[i++] = (Datum) MyProcPid;
values[i++] = (Datum) 0; /* no notifies pending */
tuple = heap_formtuple(RelationGetDescr(lRel), values, nulls);
*
* This is executed by the SQL unlisten command.
*
- * Remove the backend from the list of listening backends
+ * Remove the current backend from the list of listening backends
* for the specified relation.
*
- * Results:
- * XXX
- *
* Side effects:
* pg_listener is updated.
*
*--------------------------------------------------------------
*/
void
-Async_Unlisten(char *relname, int pid)
+Async_Unlisten(const char *relname)
{
Relation lRel;
HeapScanDesc scan;
}
if (Trace_notify)
- elog(DEBUG1, "Async_Unlisten(%s,%d)", relname, pid);
+ elog(DEBUG1, "Async_Unlisten(%s,%d)", relname, MyProcPid);
lRel = heap_open(ListenerRelationId, ExclusiveLock);
{
Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(tuple);
- if (listener->listenerpid == pid &&
+ if (listener->listenerpid == MyProcPid &&
strncmp(NameStr(listener->relname), relname, NAMEDATALEN) == 0)
{
/* Found the matching tuple, delete it */
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.28 2005/06/17 22:32:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/async.h,v 1.29 2005/10/06 21:30:39 neilc Exp $
*
*-------------------------------------------------------------------------
*/
extern bool Trace_notify;
/* notify-related SQL statements */
-extern void Async_Notify(char *relname);
-extern void Async_Listen(char *relname, int pid);
-extern void Async_Unlisten(char *relname, int pid);
+extern void Async_Notify(const char *relname);
+extern void Async_Listen(const char *relname);
+extern void Async_Unlisten(const char *relname);
/* perform (or cancel) outbound notify processing at transaction commit */
extern void AtCommit_Notify(void);