diff options
author | joerg <joerg@pkgsrc.org> | 2016-06-23 15:07:39 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2016-06-23 15:07:39 +0000 |
commit | 7ef468207ca880aed1534cad2eed04fec36d7fb3 (patch) | |
tree | 41bd3cd1a7524242c1a25bd134ada2c33758b296 /pkgtools | |
parent | 43d5dfeb782706738050ff6ee76e9b11887a9a03 (diff) | |
download | pkgsrc-7ef468207ca880aed1534cad2eed04fec36d7fb3.tar.gz |
pbulk-base-0.53:
After processing the tree-scan job, reassign jobs to all idle clients.
Before, this was only necessary at the very start of the build.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pbulk-base/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/pscan/master.c | 28 |
2 files changed, 21 insertions, 11 deletions
diff --git a/pkgtools/pbulk-base/Makefile b/pkgtools/pbulk-base/Makefile index 4e134ffb52b..9f5d68a90b5 100644 --- a/pkgtools/pbulk-base/Makefile +++ b/pkgtools/pbulk-base/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.23 2016/06/20 17:54:43 joerg Exp $ +# $NetBSD: Makefile,v 1.24 2016/06/23 15:07:39 joerg Exp $ -DISTNAME= pbulk-base-0.52 +DISTNAME= pbulk-base-0.53 COMMENT= Core components of the modular bulk build framework .include "../../pkgtools/pbulk/Makefile.common" diff --git a/pkgtools/pbulk/files/pbulk/pscan/master.c b/pkgtools/pbulk/files/pbulk/pscan/master.c index 09bef0d3298..84e5197b5be 100644 --- a/pkgtools/pbulk/files/pbulk/pscan/master.c +++ b/pkgtools/pbulk/files/pbulk/pscan/master.c @@ -1,4 +1,4 @@ -/* $NetBSD: master.c,v 1.11 2015/12/07 16:52:40 joerg Exp $ */ +/* $NetBSD: master.c,v 1.12 2016/06/23 15:07:39 joerg Exp $ */ /*- * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -68,6 +68,7 @@ struct scan_peer { }; static void assign_job(struct scan_peer *); +static void reassign_jobs(void); static void do_nothing(void *arg) @@ -106,6 +107,7 @@ finish_job(void *arg) LIST_REMOVE(peer, peer_link); process_job(peer->job, JOB_DONE); assign_job(peer); + reassign_jobs(); } static void @@ -202,6 +204,21 @@ assign_job(struct scan_peer *peer) } static void +reassign_jobs(void) +{ + struct scan_peer *peer; + + while ((peer = LIST_FIRST(&inactive_peers)) != NULL) { + if (!has_job()) + break; + LIST_REMOVE(peer, peer_link); + assign_job(peer); + if (peer-> job == NULL) + break; + } +} + +static void listen_handler(int sock, void *arg) { struct scan_peer *peer; @@ -225,7 +242,6 @@ listen_handler(int sock, void *arg) static void child_handler(struct signal_event *ev) { - struct scan_peer *peer; int status; if (waitpid(child_pid, &status, WNOHANG) == -1) { @@ -238,13 +254,7 @@ child_handler(struct signal_event *ev) clients_started = 1; signal_del(ev); - - while ((peer = LIST_FIRST(&inactive_peers)) != NULL) { - LIST_REMOVE(peer, peer_link); - assign_job(peer); - if (peer-> job == NULL) - break; - } + reassign_jobs(); } void |