From 7e4ba76504f4e9acd48e43449eebf14e59a18874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Sun, 5 Nov 2000 19:46:34 +0100 Subject: [PATCH] Replaced a few uses of STATIC_MUTEX_INIT with calls to mt_init(). This should fix a few warnings. Rev: src/modules/HTTPLoop/accept_and_parse.c:1.20 Rev: src/modules/HTTPLoop/cache.c:1.15 Rev: src/modules/HTTPLoop/cache.h:1.8 --- src/modules/HTTPLoop/accept_and_parse.c | 9 +++++++-- src/modules/HTTPLoop/cache.c | 18 ++++++++++++------ src/modules/HTTPLoop/cache.h | 6 +++--- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/modules/HTTPLoop/accept_and_parse.c b/src/modules/HTTPLoop/accept_and_parse.c index 818a37e9f1..e23c957949 100644 --- a/src/modules/HTTPLoop/accept_and_parse.c +++ b/src/modules/HTTPLoop/accept_and_parse.c @@ -73,10 +73,10 @@ struct program *accept_loop_program; #endif #define MAXLEN (1024*1024*10) -static MUTEX_T queue_mutex STATIC_MUTEX_INIT; +static MUTEX_T queue_mutex; static struct args *request, *last; -static MUTEX_T arg_lock STATIC_MUTEX_INIT; +static MUTEX_T arg_lock; static int next_free_arg, num_args; static struct args *free_arg_list[100]; @@ -684,6 +684,11 @@ void pike_module_init() #include "static_strings.h" #undef STRING + mt_init(&queue_mutex); + mt_init(&arg_lock); + + aap_init_cache(); + #ifdef HAVE_TIMEOUTS aap_init_timeouts(); #endif diff --git a/src/modules/HTTPLoop/cache.c b/src/modules/HTTPLoop/cache.c index 3fc66c5b5d..1eb54c55c5 100644 --- a/src/modules/HTTPLoop/cache.c +++ b/src/modules/HTTPLoop/cache.c @@ -33,9 +33,9 @@ struct cache *first_cache; static struct pike_string *free_queue[1024]; static int numtofree; -static MUTEX_T tofree_mutex STATIC_MUTEX_INIT; +static MUTEX_T tofree_mutex; -static MUTEX_T cache_entry_lock STATIC_MUTEX_INIT; +static MUTEX_T cache_entry_lock; int next_free_ce, num_cache_entries; struct cache_entry *free_cache_entries[1024]; @@ -69,7 +69,7 @@ struct cache_entry *new_cache_entry( ) return res; } -static void really_free_from_queue() +static void really_free_from_queue(void) /* Must have tofree lock and interpreter lock */ { int i; @@ -78,7 +78,7 @@ static void really_free_from_queue() numtofree=0; } -static int ensure_interpreter_lock( ) +static int ensure_interpreter_lock(void) { struct thread_state *thi; int free=0; @@ -102,7 +102,7 @@ static int ensure_interpreter_lock( ) return 1; } -static void free_from_queue() +static void free_from_queue(void) { /* We have the interpreter lock here, this is a backend callback */ mt_lock( &tofree_mutex ); @@ -288,9 +288,15 @@ struct cache_entry *aap_cache_lookup(char *s, ptrdiff_t len, return 0; } -void aap_clean_cache() +void aap_clean_cache(void) { struct cache *c = first_cache; if(numtofree) free_from_queue(); } + +void aap_init_cache(void) +{ + mt_init(&tofree_mutex); + mt_init(&cache_entry_lock); +} #endif diff --git a/src/modules/HTTPLoop/cache.h b/src/modules/HTTPLoop/cache.h index 644337f388..0eff75ab50 100644 --- a/src/modules/HTTPLoop/cache.h +++ b/src/modules/HTTPLoop/cache.h @@ -12,11 +12,11 @@ void simple_aap_free_cache_entry(struct cache *c, struct cache_entry *e); void aap_cache_insert(struct cache_entry *ce, struct cache *c); -void aap_clean_cache(); +void aap_clean_cache(void); void aap_enqueue_string_to_free( struct pike_string *s ); -struct cache_entry *new_cache_entry( ); +struct cache_entry *new_cache_entry(void); extern struct cache *first_cache; - +void aap_init_cache(void); -- GitLab