Soft'N'Design Software
/
projects
/
morep.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1eb700d
)
correct kill task function
author
Mazet Laurent
<laurent.mazet@thalesgroup.com>
Tue, 6 May 2025 15:29:32 +0000
(17:29 +0200)
committer
Mazet Laurent
<laurent.mazet@thalesgroup.com>
Tue, 6 May 2025 15:29:32 +0000
(17:29 +0200)
task.c
patch
|
blob
|
blame
|
history
diff --git
a/task.c
b/task.c
index cf655d29662ef3f6d0db717f2514bfe00bd4d26e..e84de0474770c2326b4aa2c927f9783f45673403 100644
(file)
--- a/
task.c
+++ b/
task.c
@@
-336,7
+336,13
@@
task_t *create_async_task (const char *name, int (*task) (sub_task_t *, int),
void kill_all_subtasks (task_t *t, int sig)
{
for (int i = 0; i < t->nb_sub_tasks; i++) {
- pthread_kill (t->sub_task_list[i].thread, sig);
+ pthread_cancel (t->sub_task_list[i].thread);
+ void *res;
+ pthread_join (t->sub_task_list[i].thread, &res);
+ if (res != PTHREAD_CANCELED) {
+ VERBOSE (coretools, WARNING, PRINTF ("can't cancel thread %ld\n", t->sub_task_list[i].thread));
+ pthread_kill (t->sub_task_list[i].thread, sig);
+ }
}
free (t->sub_task_list);
free (t);