소스 검색

Do not add new timers when server is about to stop

bel 11 년 전
부모
커밋
d72324832f
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/timer.inl

+ 4 - 0
src/timer.inl

@@ -25,6 +25,10 @@ static int timer_add(struct mg_context * ctx, double next_time, double period, i
     int error = 0;
     struct timespec now;
 
+    if (ctx->stop_flag) {
+        return 0;
+    }
+
     if (is_relative) {
         clock_gettime(CLOCK_MONOTONIC, &now);
         next_time += now.tv_sec;