浏览代码

deps-libff: Abort timer thread instead of cancelling

John Bradley 10 年之前
父节点
当前提交
47783f26c7
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      deps/libff/libff/ff-timer.c

+ 5 - 1
deps/libff/libff/ff-timer.c

@@ -99,7 +99,11 @@ void ff_timer_free(struct ff_timer *timer)
 
 
 	assert(timer != NULL);
 	assert(timer != NULL);
 
 
-	pthread_cancel(timer->timer_thread);
+	pthread_mutex_lock(&timer->mutex);
+	timer->abort = true;
+	pthread_cond_signal(&timer->cond);
+	pthread_mutex_unlock(&timer->mutex);
+
 	pthread_join(timer->timer_thread, &thread_result);
 	pthread_join(timer->timer_thread, &thread_result);
 
 
 	pthread_mutex_destroy(&timer->mutex);
 	pthread_mutex_destroy(&timer->mutex);