Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18388
| References | <CABicbJKPmckzRwKa9BgTzP8p+nVO98eKh2s1=ZDjBSoY-N1OvQ@mail.gmail.com> <mailman.4327.1325555666.27778.python-list@python.org> <63817f2b-ccf8-4d7d-92a6-c1d622986d8a@j10g2000vbe.googlegroups.com> <20120103094415.072db024@bouzin.lan> |
|---|---|
| Date | 2012-01-03 19:58 +1100 |
| Subject | Re: Avoid race condition with Popen.send_signal |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4341.1325581146.27778.python-list@python.org> (permalink) |
On Tue, Jan 3, 2012 at 7:44 PM, Jérôme <jerome@jolimont.fr> wrote: > If so, I don't see how I can protect myself from that. Checking the process > is alive and then hoping that the time interval for the race condition is so > small that there are few chances for that to happen (because the OS > quarantines PID numbers for a while, for instance) ? The probability is extremely small. PIDs are generally allocated sequentially, and obviously one won't be reallocated until the previous process has terminated. You're looking at a narrow window of opportunity between a check and an action; you don't really need to worry about PID reuse within that window, unless there's a particular reason to fear it (eg your process is very low priority, or there's a lot of "process spinning" happening). Under normal circumstances, you won't see a new process start up with the same PID for some time. (I can't make a statement on Python's module, though.) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Avoid race condition with Popen.send_signal Cameron Simpson <cs@zip.com.au> - 2012-01-03 12:44 +1100
Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-02 19:16 -0800
Re: Avoid race condition with Popen.send_signal Cameron Simpson <cs@zip.com.au> - 2012-01-03 15:53 +1100
Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 06:52 -0800
Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 09:44 +0100
Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 06:12 -0800
Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 16:09 +0100
Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 09:58 -0800
Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 19:45 +0100
Re: Avoid race condition with Popen.send_signal Chris Angelico <rosuav@gmail.com> - 2012-01-03 19:58 +1100
Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 06:20 -0800
Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 10:38 +0100
Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 07:03 -0800
Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 17:24 +0100
Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 18:25 +0100
csiph-web