Mercurial > sci
comparison sciworkerd/sciworkerd.c @ 85:cf49ab595e2e default tip @
sciworkerd: avoid spawning several tasks
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 09 Mar 2023 10:43:48 +0100 |
parents | f3fc80a2bed7 |
children |
comparison
equal
deleted
inserted
replaced
84:f3fc80a2bed7 | 85:cf49ab595e2e |
---|---|
75 static inline int | 75 static inline int |
76 pending(intmax_t job_id) | 76 pending(intmax_t job_id) |
77 { | 77 { |
78 const struct taskentry *iter; | 78 const struct taskentry *iter; |
79 | 79 |
80 /* Check if that task is listed for build. */ | |
80 LL_FOREACH(taskpending, iter) | 81 LL_FOREACH(taskpending, iter) |
82 if (iter->job_id == job_id) | |
83 return 1; | |
84 | |
85 /* | |
86 * But also make sure we don't add tasks that are already running as | |
87 * well. | |
88 */ | |
89 LL_FOREACH(tasks, iter) | |
81 if (iter->job_id == job_id) | 90 if (iter->job_id == job_id) |
82 return 1; | 91 return 1; |
83 | 92 |
84 return 0; | 93 return 0; |
85 } | 94 } |