Re: Stats collection on Windows

From: "stephen joseph butler" <stephen(dot)butler(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Stats collection on Windows
Date: 2006-04-05 14:42:19
Message-ID: f107df20604050742j1a158b2fh5f60d0427b9c3384@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2006/4/5, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> AFAICS, don't-reuse-PIDs-too-quick has exact analogs that Windows has
> to solve by ensuring it doesn't reuse HANDLEs too quick.

There's a disconnect here. handles aren't process identifiers: they're
reference counted "pointers" to the kernel structures for the process. If
you are holding a handle (ie: from CreateProcess or OpenProcess) that handle
cannot and will not be reclaimed until you call CloseHandle (or your process
itself exits). You should never retain a handle after you've called
CloseHandle on it.

Which brings an interesting thought: are process ID's reclaimed while open
handles remain? I'm willing to bet the answer is no. In that case, the stats
collector could retain the handle until it's done with the process ID.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-04-05 14:42:40 Re: Stats collection on Windows
Previous Message Tom Lane 2006-04-05 14:32:32 Re: Tru64/Alpha problems