Lines Matching refs:thread

277 /* Generic thread-based implementation for OSes that lack proper timers. */
297 deThread thread; /*!< Thread. */
308 deTimerThread* curThread; /*!< Current timer thread. */
313 deTimerThread* thread = (deTimerThread*)arg;
322 deMutex_lock(thread->lock);
324 if (thread->state == TIMERSTATE_SINGLE && numCallbacks > 0)
327 thread->state = TIMERSTATE_DISABLED;
330 else if (thread->state == TIMERSTATE_DISABLED)
333 deMutex_unlock(thread->lock);
335 sleepTime = thread->interval - (int)(((deInt64)deGetMicroseconds()-lastCallback)/1000);
340 thread->callback(thread->callbackArg);
345 deMutex_unlock(thread->lock);
349 /* Destroy thread except thread->thread. */
350 deMutex_destroy(thread->lock);
351 deFree(thread);
357 deTimerThread* thread = (deTimerThread*)deCalloc(sizeof(deTimerThread));
361 if (!thread)
364 thread->callback = callback;
365 thread->callbackArg = arg;
366 thread->interval = interval;
367 thread->lock = deMutex_create(DE_NULL);
368 thread->state = state;
370 thread->thread = deThread_create(timerThread, thread, DE_NULL);
371 if (!thread->thread)
373 deMutex_destroy(thread->lock);
374 deFree(thread);
378 return thread;
448 /* Just set state to disabled and destroy thread handle. */
449 /* \note Assumes that deThread_destroy() can be called while thread is still running
450 * and it will not terminate the thread.
453 deThread_destroy(timer->curThread->thread);
454 timer->curThread->thread = 0;
461 /* Single timer has expired - we must destroy whole thread structure. */
463 deThread_destroy(timer->curThread->thread);