MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / timer_notify_thread

Function timer_notify_thread

mysys/posix_timers.c:57–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55*/
56
57static void *
58timer_notify_thread(void *arg)
59{
60 sigset_t set;
61 siginfo_t info;
62 pthread_barrier_t *barrier= arg;
63
64 my_thread_init();
65
66 sigemptyset(&set);
67 sigaddset(&set, MY_TIMER_EVENT_SIGNO);
68 sigaddset(&set, MY_TIMER_KILL_SIGNO);
69
70 /* Get the thread ID of the current thread. */
71 thread_id= (pid_t) syscall(SYS_gettid);
72
73 /* Wake up parent thread, thread_id is available. */
74 pthread_barrier_wait(barrier);
75
76 while (1)
77 {
78 if (sigwaitinfo(&set, &info) < 0)
79 continue;
80
81 if (info.si_signo == MY_TIMER_EVENT_SIGNO)
82 timer_notify_function(info.si_value);
83 else if (info.si_signo == MY_TIMER_KILL_SIGNO)
84 break;
85 }
86
87 my_thread_end();
88
89 return NULL;
90}
91
92
93/**

Callers

nothing calls this directly

Calls 3

my_thread_initFunction · 0.85
timer_notify_functionFunction · 0.85
my_thread_endFunction · 0.85

Tested by

no test coverage detected