Changeset 23379
- Timestamp:
- 09/13/07 10:40:43 (15 months ago)
- Files:
-
- 1 modified
-
trunk/launchd/src/launchd_core_logic.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_core_logic.c
r23378 r23379 251 251 static void semaphoreitem_watch(job_t j, struct semaphoreitem *si); 252 252 static void semaphoreitem_ignore(job_t j, struct semaphoreitem *si); 253 static void semaphoreitem_runtime_mod_ref(struct semaphoreitem *si, bool add); 253 254 254 255 #define ACTIVE_JOB_HASH_SIZE 32 … … 2330 2331 time_t respawn_delta = j->min_run_time - td; 2331 2332 2333 /* 2334 * We technically should ref-count throttled jobs to prevent idle exit, 2335 * but we're not directly tracking the 'throttled' state at the moment. 2336 */ 2337 2332 2338 job_log(j, LOG_WARNING, "Throttling respawn: Will start in %ld seconds", respawn_delta); 2333 2339 job_assumes(j, kevent_mod((uintptr_t)j, EVFILT_TIMER, EV_ADD|EV_ONESHOT, NOTE_SECONDS, respawn_delta, j) != -1); … … 4573 4579 SLIST_INSERT_HEAD(&j->semaphores, si, sle); 4574 4580 4575 runtime_add_ref();4581 semaphoreitem_runtime_mod_ref(si, true); 4576 4582 4577 4583 return true; … … 4579 4585 4580 4586 void 4587 semaphoreitem_runtime_mod_ref(struct semaphoreitem *si, bool add) 4588 { 4589 /* 4590 * External events need to be tracked. 4591 * Internal events do NOT need to be tracked. 4592 */ 4593 4594 switch (si->why) { 4595 case SUCCESSFUL_EXIT: 4596 case FAILED_EXIT: 4597 case OTHER_JOB_ENABLED: 4598 case OTHER_JOB_DISABLED: 4599 case OTHER_JOB_ACTIVE: 4600 case OTHER_JOB_INACTIVE: 4601 return; 4602 default: 4603 break; 4604 } 4605 4606 if (add) { 4607 runtime_add_ref(); 4608 } else { 4609 runtime_del_ref(); 4610 } 4611 } 4612 4613 void 4581 4614 semaphoreitem_delete(job_t j, struct semaphoreitem *si) 4582 4615 { 4616 semaphoreitem_runtime_mod_ref(si, false); 4617 4583 4618 SLIST_REMOVE(&j->semaphores, si, semaphoreitem, sle); 4584 4619 … … 4588 4623 4589 4624 free(si); 4590 4591 runtime_del_ref();4592 4625 } 4593 4626

