MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / start_timer_processes

Function start_timer_processes

timer.c:701–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699
700
701int start_timer_processes(void)
702{
703 int id;
704 const struct internal_fork_params
705 ifp_tk = {
706 .proc_desc = "time_keeper",
707 .flags = OSS_PROC_NO_IPC|OSS_PROC_NO_LOAD,
708 .type = TYPE_NONE,
709 },
710 ifp_timer = {
711 .proc_desc = "timer",
712 .flags = OSS_PROC_NO_IPC|OSS_PROC_NO_LOAD,
713 .type = TYPE_NONE,
714 };
715
716 /*
717 * A change of the way timers were run. In the pre-1.5 times,
718 * all timer processes had their own jiffies and just the first
719 * one was doing the global ones. Now, there's a separate process
720 * that increases jiffies - run_timer_process_jif(), and the rest
721 * just use that one.
722 *
723 * The main reason for this change was when a function that relied
724 * on jiffies for its timeouts got called from the timer thread and
725 * was unable to detect timeouts.
726 */
727 if ( (id=internal_fork(&ifp_tk))<0 ) {
728 LM_CRIT("cannot fork time keeper process\n");
729 goto error;
730 } else if (id==0) {
731 /* new process */
732 clean_write_pipeend();
733
734 run_timer_process_jif();
735 exit(-1);
736 }
737
738 /* fork a timer-trigger process */
739 if ( (id=internal_fork(&ifp_timer))<0 ) {
740 LM_CRIT("cannot fork timer process\n");
741 goto error;
742 } else if (id==0) {
743 /* new process */
744 clean_write_pipeend();
745
746 run_timer_process( );
747 exit(-1);
748 }
749
750 return 0;
751error:
752 return -1;
753}
754
755
756inline static int handle_io(struct fd_map* fm, int idx,int event_type)

Callers 1

main_loopFunction · 0.85

Calls 4

internal_forkFunction · 0.85
clean_write_pipeendFunction · 0.85
run_timer_process_jifFunction · 0.85
run_timer_processFunction · 0.85

Tested by

no test coverage detected