[launchd-changes] [23204] trunk/launchd/src/launchd_core_logic.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Apr 4 15:36:37 PDT 2007
Revision: 23204
http://trac.macosforge.org/projects/launchd/changeset/23204
Author: zarzycki at apple.com
Date: 2007-04-04 15:36:36 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
Better jobmgr_t GC.
Modified Paths:
--------------
trunk/launchd/src/launchd_core_logic.c
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2007-04-04 20:05:30 UTC (rev 23203)
+++ trunk/launchd/src/launchd_core_logic.c 2007-04-04 22:36:36 UTC (rev 23204)
@@ -236,7 +236,6 @@
static jobmgr_t jobmgr_parent(jobmgr_t jm);
static jobmgr_t jobmgr_do_garbage_collection(jobmgr_t jm);
static void jobmgr_reap_bulk(jobmgr_t jm, struct kevent *kev);
-static bool jobmgr_is_idle(jobmgr_t jm);
static void jobmgr_log_stray_children(jobmgr_t jm);
static void jobmgr_remove(jobmgr_t jm);
static void jobmgr_dispatch_all(jobmgr_t jm, bool newmounthack);
@@ -3458,12 +3457,6 @@
jobmgr_log(jm, LOG_DEBUG, "Garbage collecting.");
- if (jobmgr_is_idle(jm)) {
- jobmgr_log_stray_children(jm);
- jobmgr_remove(jm);
- return NULL;
- }
-
if (jm->hopefully_first_cnt) {
return jm;
}
@@ -3484,30 +3477,39 @@
}
jm->sent_stop_to_normal_jobs = true;
- return jm;
}
if (jm->normal_active_cnt) {
return jm;
}
- if (jm->sent_stop_to_hopefully_last_jobs) {
+ if (!jm->sent_stop_to_hopefully_last_jobs) {
+ jobmgr_log(jm, LOG_DEBUG, "Asking \"hopefully last\" jobs to exit.");
+
+ LIST_FOREACH(ji, &jm->jobs, sle) {
+ if (ji->p && ji->anonymous) {
+ continue;
+ } else if (ji->p && job_assumes(ji, ji->hopefully_exits_last)) {
+ job_stop(ji);
+ }
+ }
+
+ jm->sent_stop_to_hopefully_last_jobs = true;
+ }
+
+ if (!SLIST_EMPTY(&jm->submgrs)) {
return jm;
}
- jobmgr_log(jm, LOG_DEBUG, "Asking \"hopefully last\" jobs to exit.");
-
LIST_FOREACH(ji, &jm->jobs, sle) {
- if (ji->p && ji->anonymous) {
- continue;
- } else if (ji->p && job_assumes(ji, ji->hopefully_exits_last)) {
- job_stop(ji);
+ if (!ji->anonymous) {
+ return jm;
}
}
- jm->sent_stop_to_hopefully_last_jobs = true;
-
- return jm;
+ jobmgr_log_stray_children(jm);
+ jobmgr_remove(jm);
+ return NULL;
}
void
@@ -3552,24 +3554,6 @@
free(kp);
}
-bool
-jobmgr_is_idle(jobmgr_t jm)
-{
- job_t ji;
-
- if (!SLIST_EMPTY(&jm->submgrs)) {
- return false;
- }
-
- LIST_FOREACH(ji, &jm->jobs, sle) {
- if (ji->p && !ji->anonymous) {
- return false;
- }
- }
-
- return true;
-}
-
jobmgr_t
jobmgr_parent(jobmgr_t jm)
{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20070404/b9770e26/attachment.html
More information about the launchd-changes
mailing list