Improvement suggestion: listen to signals to adjust number of jobs

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Improvement suggestion: listen to signals to adjust number of jobs

Henrik Carlqvist
Many times after starting make I have wished that I started it with more
parallel jobs than I did. A few time I have also wished that I started
make with fewer parallel jobs.

The attached patch allows you to send SIGUSR2 to your top level make
process to add one more parallel job.

Once a SIGUSR2 is received the functionality of SIGUSR1 also changes from
toggling debug output to decrease the number of jobs by 1. No running job
will be killed, but when the next target is finished one less job will be
started again.

If make was started with parallel jobs SIGUSR2 will immediately increase
the number of jobs with one. If make was started without -j SIGUSR2
will not cause make to work in parallel until the current target is
finished.

The patch was written against latest from git, but also works with latest
stable version 4.2.1. My intention has been to make the patch work with
both Unix and Windows, but unfortunately I have no Windows machine to test
with. I'm not even sure if Windows supports bsd signals. If not, my
changes to w32/w32os.c should better be undone.

I hope that you will find my patch useful and that it somehow will make it
into upcoming stable releases of make.

Please feel free to discuss improvements of the patch, I have subscribed
to this mailing list.

regards Henrik

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make

signal_num_jobs2.patch (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Improvement suggestion: listen to signals to adjust number of jobs

Eli Zaretskii
> Date: Tue, 23 May 2017 20:59:01 +0200
> From: Henrik Carlqvist <[hidden email]>
>
> My intention has been to make the patch work with
> both Unix and Windows, but unfortunately I have no Windows machine to test
> with. I'm not even sure if Windows supports bsd signals. If not, my
> changes to w32/w32os.c should better be undone.

There are no signals on Windows, not in the Posix sense.  Certainly
there is nothing similar to SIGUSR2 there.

If we want to support this feature on Windows, we need to use some
other mechanism, like maybe the Ctrl-BREAK handler?

Thanks.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

Re: Improvement suggestion: listen to signals to adjust number of jobs

Henrik Carlqvist
On Tue, 23 May 2017 22:31:14 +0300
Eli Zaretskii <[hidden email]> wrote:

> > From: Henrik Carlqvist <[hidden email]>
> > My intention has been to make the patch work with
> > both Unix and Windows, but unfortunately I have no Windows machine to
> > test with. I'm not even sure if Windows supports bsd signals. If not,
> > my changes to w32/w32os.c should better be undone.

> There are no signals on Windows, not in the Posix sense.  Certainly
> there is nothing similar to SIGUSR2 there.

Thanks for the information! To this message I attach an updated patch
where no attempt is made to modify w32os.c.
 
> If we want to support this feature on Windows, we need to use some
> other mechanism, like maybe the Ctrl-BREAK handler?

Unfortunately I will not be able to give much help in suggesting how this
should be implemented on Windows, but please feel free to improve my patch
so that it also becomes useful on Windows! If Windows lack SIGUSR* I
suppose that make does not support toggling of debug output on Windows?

regards Henrik

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make

signal_num_jobs3.patch (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Improvement suggestion: listen to signals to adjust number of jobs

Eli Zaretskii
> Date: Tue, 23 May 2017 22:10:55 +0200
> From: Henrik Carlqvist <[hidden email]>
> Cc: [hidden email]
>
> If Windows lack SIGUSR* I suppose that make does not support
> toggling of debug output on Windows?

Indeed, it doesn't.

_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make