[launchd-changes] [23963] branches/PR-7431992/launchd/src
source_changes at macosforge.org
source_changes at macosforge.org
Wed Dec 2 17:39:39 PST 2009
Revision: 23963
http://trac.macosforge.org/projects/launchd/changeset/23963
Author: dsorresso at apple.com
Date: 2009-12-02 17:39:35 -0800 (Wed, 02 Dec 2009)
Log Message:
-----------
Hopeful fix for <rdar://problem/7431992>.
Modified Paths:
--------------
branches/PR-7431992/launchd/src/launchd_runtime.c
branches/PR-7431992/launchd/src/launchd_runtime.h
Modified: branches/PR-7431992/launchd/src/launchd_runtime.c
===================================================================
--- branches/PR-7431992/launchd/src/launchd_runtime.c 2009-12-03 00:21:03 UTC (rev 23962)
+++ branches/PR-7431992/launchd/src/launchd_runtime.c 2009-12-03 01:39:35 UTC (rev 23963)
@@ -102,8 +102,8 @@
static struct ldcred ldc;
static size_t runtime_busy_cnt;
static size_t runtime_standby_cnt;
+static size_t runtime_busy_time;
-
static STAILQ_HEAD(, logmsg_s) logmsg_queue = STAILQ_HEAD_INITIALIZER(logmsg_queue);
static size_t logmsg_queue_sz;
static size_t logmsg_queue_cnt;
@@ -1579,7 +1579,9 @@
_vproc_transaction_begin();
#endif
}
+
runtime_busy_cnt++;
+ runtime_remove_timer();
}
void
@@ -1595,7 +1597,9 @@
_vproc_transaction_end();
#endif
}
+
runtime_busy_cnt--;
+ runtime_install_timer();
}
void
@@ -1620,6 +1624,22 @@
runtime_standby_cnt--;
}
+void
+runtime_install_timer(void)
+{
+ if( !pid1_magic && runtime_busy_cnt == 0 ) {
+ launchd_assumes(kevent_mod((uintptr_t)&runtime_busy_time, EVFILT_TIMER, EV_ADD, NOTE_SECONDS, 30, NULL) != -1);
+ }
+}
+
+void
+runtime_remove_timer(void)
+{
+ if( !pid1_magic && runtime_busy_cnt > 0 ) {
+ launchd_assumes(kevent_mod((uintptr_t)&runtime_busy_time, EVFILT_TIMER, EV_DELETE, 0, 0, NULL) != -1);
+ }
+}
+
kern_return_t
catch_mach_exception_raise(mach_port_t exception_port __attribute__((unused)), mach_port_t thread, mach_port_t task,
exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt)
Modified: branches/PR-7431992/launchd/src/launchd_runtime.h
===================================================================
--- branches/PR-7431992/launchd/src/launchd_runtime.h 2009-12-03 00:21:03 UTC (rev 23962)
+++ branches/PR-7431992/launchd/src/launchd_runtime.h 2009-12-03 01:39:35 UTC (rev 23963)
@@ -118,6 +118,8 @@
void runtime_del_ref(void);
void runtime_add_weak_ref(void);
void runtime_del_weak_ref(void);
+void runtime_install_timer(void);
+void runtime_remove_timer(void);
void launchd_runtime_init(void);
void launchd_runtime_init2(void);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-changes/attachments/20091202/b331900b/attachment.html>
More information about the launchd-changes
mailing list