|
Boost : |
Subject: Re: [boost] [Boost-users] Brainstorming [WAS: Subject: Formal Review of Proposed Boost.Process library starts tomorrow]
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2011-02-14 16:02:38
On 02/14/2011 01:00 PM, Jeremy Maitin-Shepard wrote:
> On 02/14/2011 12:50 PM, Oliver Kowalke wrote:
>> Am 14.02.2011 21:14, schrieb Jeremy Maitin-Shepard:
>>> SIGCHLD handler will repeatedly invoke waitpid(-1, &status, WNOHANG |
>>> WUNTRACED | WCONTINUED), and then invoke any registered handlers.
>>
>> why polling - it waists CPU cycles?
>> I expect that the thread waiting for child processes state change blocks
>> (gets suspended) until it is notified by the kernel that something has
>> happened.
>> other worker-thread do other stuff like communicating with other process
>> etc.
>
> It wouldn't poll indefinitely, as that would lock up the thread in which
> the signal handler was invoked. It is simply invoked repeatedly until
> the error ECHILD (meaning no more unwaited-for children) is returned.
> The notification is in the form of SIGCHLD, but that just means one or
> more children need to be waited on.
Sorry, it is invoked repeatedly until waitpid returns 0.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk