diff options
Diffstat (limited to 'src/comp.c')
-rw-r--r-- | src/comp.c | 32 |
1 files changed, 6 insertions, 26 deletions
@@ -358,31 +358,15 @@ prog_is_leftover (struct prog *prog) | |||
358 | return IS_COMPONENT (prog) && !component_is_active (prog->v.p.comp); | 358 | return IS_COMPONENT (prog) && !component_is_active (prog->v.p.comp); |
359 | } | 359 | } |
360 | 360 | ||
361 | /* If PROG is a leftover, gracefully stop it and mark as disabled */ | 361 | /* If PROG is a leftover, mark it for termination */ |
362 | static int | 362 | static int |
363 | cb_terminate_prog (struct prog *prog, void *data) | 363 | mark_prog (struct prog *prog, void *data) |
364 | { | 364 | { |
365 | if (prog_is_leftover (prog)) | 365 | if (prog_is_leftover (prog)) |
366 | progman_stop_component (&prog); | 366 | prog->v.p.stop = 1; |
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | /* If PROG is a leftover, slay it with SIGKILL */ | ||
371 | static int | ||
372 | cb_kill_prog (struct prog *prog, void *data) | ||
373 | { | ||
374 | if (prog_is_leftover (prog)) | ||
375 | prog_stop (prog, SIGKILL); | ||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | static int | ||
380 | list_is_empty (void *p) | ||
381 | { | ||
382 | struct complist *list = p; | ||
383 | return list->head == NULL; | ||
384 | } | ||
385 | |||
386 | static int | 370 | static int |
387 | list_str_cmp (const void *a, const void *b) | 371 | list_str_cmp (const void *a, const void *b) |
388 | { | 372 | { |
@@ -504,16 +488,12 @@ component_config_commit (void) | |||
504 | comp->arridx = i; | 488 | comp->arridx = i; |
505 | } | 489 | } |
506 | 490 | ||
507 | /* Terminate orphaned progs */ | 491 | /* Mark orphaned progs for termination */ |
508 | list = &comp_list[prev]; | 492 | list = &comp_list[prev]; |
509 | if (list->head) | 493 | if (list->head) |
510 | { | 494 | { |
511 | progman_foreach (cb_terminate_prog, NULL); | 495 | progman_foreach (mark_prog, NULL); |
512 | if (progman_wait_until (list_is_empty, list)) | 496 | pies_schedule_children (PIES_CHLD_GC); |
513 | { | ||
514 | progman_foreach (cb_kill_prog, NULL); | ||
515 | progman_wait_until (list_is_empty, list); | ||
516 | } | ||
517 | } | 497 | } |
518 | 498 | ||
519 | /* Build dependency map */ | 499 | /* Build dependency map */ |