Postgres has NOTIFY and LISTEN commands that can be used to signal another process that some event has occurred. You execute a LISTEN MYFLAG statement in one process and it blocks, waiting for you to execute a NOTIFY MYFLAG statement in the other process. These "processes" don't need to be in the same executable. A typical use would be to put the NOTIFY statement in a trigger when some condition is met, then execute the LISTEN in a C# program that blocks until the NOTIFY is raised.

You can do something similar with one connection using a loop with WAITFOR and another connection using MESSAGE ... FOR* ... - cf. the sample borrowed from the docs. I wouldn't declare that a real equivalent to NOTIFY/LISTEN, nevertheless.

Instead of waiting on any message, you could check for a particular message text, too. The notifying side may use MESSAGE ... FOR ... IMMEDIATE for faster notifications.

Disclaimer: I have not used that technique myself for real IPC.

As an OS alternative, if the processes to be sync'ed are running on the same machine, you could also use OS facilities like Win32 events with APIs like SetEvent() and WaitForSingleObject() to sync these. That's what we have used for years, and have used SQL Anywhere external functions to set/reset events or use mutexes. That's obviously very helpful when not all according processes are making database calls, and that's our situation:) - And I would think that this kind of basic OS-level IPC is the most efficient you will get...

Thanks for the response. I ended up not needing this functionality anyway.

I have two processes that need to synchronize access to a table because one of the processes creates a new table, loads data into it, then deletes the old table and renames the new one. The other process queries the table. Bad things will happen if they're not synchronized.

The two processes are implemented in different C# classes. I ended up creating a third static class that only contains a variable of type object. I lock that object before either operation takes place. It works.