[Gambas-user] Cascading child processes

Charlie Ogier charlie at cogier.com
Fri Dec 6 15:53:03 CET 2019


Hi Bruce,

What about doing the search in the background? Have a look here. 
<https://forum.gambas.one/viewtopic.php?p=1899#p1899>

Charlie

On 06/12/2019 03:37, Bruce wrote:
> (I am trying to speed up searching an increasingly large database and 
> a bunch of websites)
>
> The search program now either invokes child processes via "newproc = 
> Exec ..." or spawns via Shell. This is all fine and some of these 
> processes invoke their own set of children. Since most of them spend 
> most of their time waiting for an internet response or a complex SQL 
> query, they are mainly sleeping.
>
> Now occasionally, the searches take too long. So I want to terminate 
> them (and all their children) from the top level program,  but not the 
> top level program ("SMain") itself.
>
> I have tried using Gambas process.Kill(), process.Signal(), 
> gb.signal.Send(blah, blah) and shelling out to the "Kill" command itself.
>
> None of these have been successful. All let me terminate the process 
> invoked by SMain but all their children are left running.
>
> Looking at man 2 kill it says "If pid is less than -1, then sig is 
> sent to every process in the process group whose ID is -pid." This 
> does let me send a SIGTERM to all the processes cascading from SMain, 
> but unfortunately sends the signal to SMain itself.
>
> I can't see a way to ignore or block a SIGTERM in SMain itself (and I 
> am not sure that I really want to).
>
> So, is there something that I am not seeing/understanding here or do I 
> need to cascade the signalling down through all these programs ( and 
> if so how do I trap a signal?)?
>
> tia
> bruce
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191206/92980cba/attachment.html>


More information about the User mailing list