| 119 | |
| 120 | |
| 121 | Timer* |
| 122 | tmr_create( |
| 123 | struct iperf_time* nowP, TimerProc* timer_proc, TimerClientData client_data, |
| 124 | int64_t usecs, int periodic ) |
| 125 | { |
| 126 | struct iperf_time now; |
| 127 | Timer* t; |
| 128 | |
| 129 | getnow( nowP, &now ); |
| 130 | |
| 131 | if ( free_timers != NULL ) { |
| 132 | t = free_timers; |
| 133 | free_timers = t->next; |
| 134 | } else { |
| 135 | t = (Timer*) malloc( sizeof(Timer) ); |
| 136 | if ( t == NULL ) |
| 137 | return NULL; |
| 138 | } |
| 139 | |
| 140 | t->timer_proc = timer_proc; |
| 141 | t->client_data = client_data; |
| 142 | t->usecs = usecs; |
| 143 | t->periodic = periodic; |
| 144 | t->time = now; |
| 145 | iperf_time_add_usecs(&t->time, usecs); |
| 146 | /* Add the new timer to the active list. */ |
| 147 | list_add( t ); |
| 148 | |
| 149 | return t; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | struct timeval* |
no test coverage detected
searching dependent graphs…