diff --git a/src/modules/HTTPLoop/accept_and_parse.c b/src/modules/HTTPLoop/accept_and_parse.c index 818a37e9f11caa79ec619781ba316689f29ebf27..e23c9579494b80f23cbefa512e9847e6a7188bb1 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 3fc66c5b5d0c00699656acb67c534046c4c35025..1eb54c55c50fbd46efde3f620b0739fd0a4ecf5e 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 644337f388683f7d14912658c19f4ce5a5b4b64e..0eff75ab50d430e58f052b8385497834d77f8e78 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);