I have simplified the code according to the discussion. Now there is no pipe
or signaling threads, process access shared memory directly to pass signals.
Seems everything works fine except pg_ctl. I now have two choices to fix it:
(1) Record Shared memory name (it is already there) and the offset of
signaling shared memory in postmaster.pid; So the pg_ctl program can access
the shared memory (since it has write down the signal number there) and
SetEvent target process;
(2) Postmaster will startup a thread monitoring messages, pg_ctl simulate
"kill" by sending postmaster a message <target_pid, signum>, then postmaster
will forward this "signum" to "target_pid";
What do you think?
Regards,
Qingqing