aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-09-18 10:18:06 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-09-18 23:08:04 -0400
commit4a4cdeb3f0255b0c9979397635c3a0c930fd153f (patch)
treef880dafed7a9b188dca9295f0bfd408cabeaaf63
parent37f68b28cf1624d9188872bea1e8efc15141824c (diff)
downloadstasis-4a4cdeb3f0255b0c9979397635c3a0c930fd153f.tar.gz
Fix incorrect failure count
* No longer adds the raw status value to the failure count. Just increment it instead.
-rw-r--r--src/multiprocessing.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/multiprocessing.c b/src/multiprocessing.c
index 4ae9b31..7452314 100644
--- a/src/multiprocessing.c
+++ b/src/multiprocessing.c
@@ -335,6 +335,8 @@ int mp_pool_join(struct MultiProcessingPool *pool, size_t jobs, size_t flags) {
if (status >> 8 != 0 || (status & 0xff) != 0) {
fprintf(stderr, "%s Task failed\n", progress);
+ failures++;
+
if (flags & MP_POOL_FAIL_FAST && pool->num_used > 1) {
mp_pool_kill(pool, SIGTERM);
return -2;
@@ -353,7 +355,6 @@ int mp_pool_join(struct MultiProcessingPool *pool, size_t jobs, size_t flags) {
// Update progress and tell the poller to ignore the PID. The process is gone.
slot->pid = MP_POOL_PID_UNUSED;
- failures += status;
} else if (pid < 0) {
fprintf(stderr, "waitpid failed: %s\n", strerror(errno));
return -1;