Lines Matching refs:t
58 timer_data* t = (timer_data*)thread_data; in timer_thread() local
60 LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t->time_msec); in timer_thread()
64 if(t->time_msec >= 1000) { in timer_thread()
65 ts.tv_sec += t->time_msec/1000; in timer_thread()
66 t->time_msec = t->time_msec % 1000; in timer_thread()
68 if(t->time_msec) in timer_thread()
69 ts.tv_nsec += t->time_msec * 1000000; in timer_thread()
80 pthread_mutex_lock(&(t->timer_mutex)); in timer_thread()
81 if (READY == t->state) { in timer_thread()
82 t->state = WAITING; in timer_thread()
83 ret = pthread_cond_timedwait(&t->timer_cond, &t->timer_mutex, &ts); in timer_thread()
84 t->state = DONE; in timer_thread()
86 pthread_mutex_unlock(&(t->timer_mutex)); in timer_thread()
105 t->callback_func(t->user_data, ret); in timer_thread()
114 for (i = 0; EBUSY == pthread_mutex_destroy(&t->timer_mutex) && i <= 5; i++) { in timer_thread()
120 pthread_mutex_unlock(&t->timer_mutex); in timer_thread()
124 pthread_cond_destroy(&t->timer_cond); in timer_thread()
126 free(t); in timer_thread()
134 timer_data *t=NULL; in loc_timer_start() local
142 t = (timer_data *)calloc(1, sizeof(timer_data)); in loc_timer_start()
143 if(t == NULL) { in loc_timer_start()
149 if(pthread_cond_init(&(t->timer_cond), NULL)) { in loc_timer_start()
153 if(pthread_mutex_init(&(t->timer_mutex), NULL)) { in loc_timer_start()
158 t->callback_func = cb_func; in loc_timer_start()
159 t->user_data = caller_data; in loc_timer_start()
160 t->time_msec = msec; in loc_timer_start()
161 t->state = READY; in loc_timer_start()
169 if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) { in loc_timer_start()
181 pthread_mutex_destroy(&t->timer_mutex); in loc_timer_start()
183 pthread_cond_destroy(&t->timer_cond); in loc_timer_start()
185 free(t); in loc_timer_start()
188 return t; in loc_timer_start()
192 timer_data* t = (timer_data*)handle; in loc_timer_stop() local
194 if (NULL != t && (READY == t->state || WAITING == t->state) && in loc_timer_stop()
195 pthread_mutex_lock(&(t->timer_mutex)) == 0) { in loc_timer_stop()
196 if (READY == t->state || WAITING == t->state) { in loc_timer_stop()
197 pthread_cond_signal(&t->timer_cond); in loc_timer_stop()
198 t->state = ABORT; in loc_timer_stop()
200 pthread_mutex_unlock(&(t->timer_mutex)); in loc_timer_stop()