int64_t now;
tvh_mutex_t *mutex, dmutex;
- while (!tvhwatch_done) {
+ while (!atomic_get(&tvhwatch_done)) {
pthread_mutex_lock(&thrwatch_mutex);
now = getfastmonoclock();
mutex = TAILQ_LAST(&thrwatch_mutexes, tvh_mutex_queue);
- if (mutex && mutex->tstamp + sec2mono(55) < now) {
+ if (mutex && mutex->tstamp + sec2mono(5) < now) {
pthread_mutex_unlock(&thrwatch_mutex);
tvh_thread_mutex_deadlock(mutex);
}
tvh_thread_debug = debug_level;
tvh_thread_crash_time = getfastmonoclock() + sec2mono(15);
if (debug_level > 0) {
- tvhwatch_done = 0;
+ atomic_set(&tvhwatch_done, 0);
tvh_thread_create(&thrwatch_tid, NULL, tvh_thread_watch_thread, NULL, "thrwatch");
}
#endif
{
#if ENABLE_TRACE
if (tvh_thread_debug > 0) {
- tvhwatch_done = 1;
+ atomic_set(&tvhwatch_done, 1);
pthread_join(thrwatch_tid, NULL);
}
#endif
void
tvhlog_init ( int level, int options, const char *path )
{
- tvhlog_level = level;
+ atomic_set(&tvhlog_level, level);
tvhlog_options = options;
tvhlog_path = path ? strdup(path) : NULL;
memset(tvhlog_trace, 0, sizeof(tvhlog_trace));