Re: Process wakeups when idle and power consumption
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Peter Geoghegan <peter@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2011-05-09T10:19:23Z
Lists: pgsql-hackers
On 09.05.2011 12:20, Peter Geoghegan wrote: > I've taken a look into it, and I'm not optimistic about the likelihood > of the way I've suggested that we can register a callback on process > termination on windows being acceptable. It seems to be a kludge too > far. It does work on Vista, just not very well. There is a > considerable delay on closing the above console application that uses > this technique, for example, and there seems to be an unpredictable > delay in the callback occurring. Can't we use the pipe trick on Windows? The API is different, but we use pipes on Windows for other things already. When a process is launched, open a pipe between postmaster and the child process. In the child, spawn a thread that just calls ReadFile() on the pipe, which blocks. If postmaster dies, the ReadFile() call will return with an error. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com