瀏覽代碼

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

bel 8 年之前
父節點
當前提交
65e3cbe1cc
共有 2 個文件被更改,包括 5 次插入4 次删除
  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)
 #if defined(USE_TIMERS)
+#define TIMER_API static
 #include "timer.inl"
 #include "timer.inl"
 #endif /* USE_TIMERS */
 #endif /* USE_TIMERS */
 
 

+ 4 - 4
src/timer.inl

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