aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-04-04 15:04:21 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-04-04 15:04:21 +0200
commitbfc92795d467277200f17ec103ff42cf52690c95 (patch)
treea4be841fd4846ed560da4067eec779b9c22cacda
parent20789d94fe9706e56bf6718f81452ab4f1b0125e (diff)
Avoid to count child threads
The count of allowed threads must be the real count of threads started. Change-Id: Iaefc9fa4368042d6db45ed3333f9591da027b2f0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/jobs.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/jobs.c b/src/jobs.c
index cf1bb550..fa94ef18 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -298,14 +298,15 @@ static void thread_run(volatile struct thread *me)
me->lowered = 0;
me->waits = 0;
me->upper = current;
- if (current)
+ if (current) {
current->lowered = 1;
- else
+ } else {
+ started++;
sig_monitor_init_timeouts();
- current = (struct thread*)me;
+ }
me->next = threads;
threads = (struct thread*)me;
- started++;
+ current = (struct thread*)me;
NOTICE("job thread starting %d(/%d) %s", started, allowed, me->upper ? "child" : "parent");
@@ -359,16 +360,17 @@ static void thread_run(volatile struct thread *me)
NOTICE("job thread stoping %d(/%d) %s", started, allowed, me->upper ? "child" : "parent");
/* unlink the current thread and cleanup */
- started--;
prv = &threads;
while (*prv != me)
prv = &(*prv)->next;
*prv = me->next;
current = me->upper;
- if (current)
+ if (current) {
current->lowered = 0;
- else
+ } else {
sig_monitor_clean_timeouts();
+ started--;
+ }
}
/**