MCPcopy Create free account
hub / github.com/apache/trafficserver / tmr_create

Function tmr_create

tools/http_load/timers.c:126–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126Timer *
127tmr_create(struct timeval *nowP, TimerProc *timer_proc, ClientData client_data, long msecs, int periodic)
128{
129 Timer *t;
130
131 if (free_timers != (Timer *)0) {
132 t = free_timers;
133 free_timers = t->next;
134 } else {
135 t = (Timer *)malloc(sizeof(Timer));
136 if (t == (Timer *)0)
137 return (Timer *)0;
138 }
139
140 mstimeout_cache = -1;
141 t->timer_proc = timer_proc;
142 t->client_data = client_data;
143 t->msecs = msecs;
144 t->periodic = periodic;
145 if (nowP != (struct timeval *)0)
146 t->time = *nowP;
147 else
148 (void)gettimeofday(&t->time, (struct timezone *)0);
149 t->time.tv_sec += msecs / 1000L;
150 t->time.tv_usec += (msecs % 1000L) * 1000L;
151 if (t->time.tv_usec >= 1000000L) {
152 t->time.tv_sec += t->time.tv_usec / 1000000L;
153 t->time.tv_usec %= 1000000L;
154 }
155 t->hash = hash(t);
156 /* Add the new timer to the proper active list. */
157 l_add(t);
158
159 return t;
160}
161
162struct timeval *
163tmr_timeout(struct timeval *nowP)

Callers 4

mainFunction · 0.85
start_socketFunction · 0.85
handle_readFunction · 0.85
start_timerFunction · 0.85

Calls 2

hashFunction · 0.85
l_addFunction · 0.85

Tested by

no test coverage detected