Prechádzať zdrojové kódy

Allow to use timers outside civetweb.c (with TIMER_API define)

bel 8 rokov pred
rodič
commit
65e3cbe1cc
2 zmenil súbory, kde vykonal 5 pridanie a 4 odobranie
  1. 1 0
      src/civetweb.c
  2. 4 4
      src/timer.inl

+ 1 - 0
src/civetweb.c

@@ -9700,6 +9700,7 @@ mg_unlock_context(struct mg_context *ctx)
 }
 
 #if defined(USE_TIMERS)
+#define TIMER_API static
 #include "timer.inl"
 #endif /* USE_TIMERS */
 

+ 4 - 4
src/timer.inl

@@ -24,7 +24,7 @@ struct ttimers {
 };
 
 
-static double
+TIMER_API double
 timer_getcurrenttime(void)
 {
 #if defined(_WIN32)
@@ -51,7 +51,7 @@ timer_getcurrenttime(void)
 }
 
 
-static int
+TIMER_API int
 timer_add(struct mg_context *ctx,
           double next_time,
           double period,
@@ -189,7 +189,7 @@ timer_thread(void *thread_func_param)
 #endif /* _WIN32 */
 
 
-static int
+TIMER_API int
 timers_init(struct mg_context *ctx)
 {
 	ctx->timers = (struct ttimers *)mg_calloc(sizeof(struct ttimers), 1);
@@ -204,7 +204,7 @@ timers_init(struct mg_context *ctx)
 }
 
 
-static void
+TIMER_API void
 timers_exit(struct mg_context *ctx)
 {
 	if (ctx->timers) {