<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Hi Bruce,<br>
<br>
What about doing the search in the background? Have a look <a
moz-do-not-send="true"
href="https://forum.gambas.one/viewtopic.php?p=1899#p1899">here.</a><br>
<br>
Charlie<br>
<br>
On 06/12/2019 03:37, Bruce wrote:<br>
</div>
<blockquote type="cite"
cite="mid:a81bbd3a-f729-f358-bbf9-084897309e82@gmail.com">(I am
trying to speed up searching an increasingly large database and a
bunch of websites)
<br>
<br>
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.
<br>
<br>
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.
<br>
<br>
I have tried using Gambas process.Kill(), process.Signal(),
gb.signal.Send(blah, blah) and shelling out to the "Kill" command
itself.
<br>
<br>
None of these have been successful. All let me terminate the
process invoked by SMain but all their children are left running.
<br>
<br>
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.
<br>
<br>
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).
<br>
<br>
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?)?
<br>
<br>
tia
<br>
bruce
<br>
<br>
<br>
<br>
----[ Gambas mailing-list is hosted by <a class="moz-txt-link-freetext" href="https://www.hostsharing.net">https://www.hostsharing.net</a>
]----
<br>
</blockquote>
<br>
</body>
</html>