Hi More cleanup. This function had to be moved up due to the static declaration, which increases the changed lines stat.
- Lauri
>From 7028a2ad04864c8c993e21c5044210afc233a72e Mon Sep 17 00:00:00 2001 From: Lauri Kasanen <[email protected]> Date: Sun, 17 Jun 2012 17:18:46 +0300 Subject: [PATCH] sched: Mark mk_sched_register_thread as static Signed-off-by: Lauri Kasanen <[email protected]> --- src/include/mk_scheduler.h | 1 - src/mk_scheduler.c | 102 ++++++++++++++++++++++---------------------- 2 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/include/mk_scheduler.h b/src/include/mk_scheduler.h index cd4b939..b3a25f1 100644 --- a/src/include/mk_scheduler.h +++ b/src/include/mk_scheduler.h @@ -76,7 +76,6 @@ extern pthread_key_t worker_sched_node; extern pthread_mutex_t mutex_worker_init; void mk_sched_init(); -int mk_sched_register_thread(int epoll_fd); int mk_sched_launch_thread(int max_events, pthread_t *tout); void *mk_sched_launch_epoll_loop(void *thread_conf); struct sched_list_node *mk_sched_get_handler_owner(void); diff --git a/src/mk_scheduler.c b/src/mk_scheduler.c index f0dc218..00322ee 100644 --- a/src/mk_scheduler.c +++ b/src/mk_scheduler.c @@ -161,59 +161,10 @@ static void mk_sched_thread_lists_init() mk_sched_set_request_list(cs_list); } -/* created thread, all this calls are in the thread context */ -static void *mk_sched_launch_worker_loop(void *thread_conf) -{ - char *thread_name = 0; - unsigned long len; - sched_thread_conf *thconf = thread_conf; - int wid, epoll_max_events = thconf->epoll_max_events; - struct sched_list_node *thinfo = NULL; - mk_epoll_handlers *handler; - - /* Avoid SIGPIPE signals */ - mk_signal_thread_sigpipe_safe(); - - /* Init specific thread cache */ - mk_sched_thread_lists_init(); - mk_cache_thread_init(); - - /* Register working thread */ - wid = mk_sched_register_thread(thconf->epoll_fd); - mk_mem_free(thread_conf); - - /* Plugin thread context calls */ - mk_epoll_state_init(); - mk_plugin_event_init_list(); - mk_plugin_core_thread(); - - /* Epoll event handlers */ - handler = mk_epoll_set_handlers((void *) mk_conn_read, - (void *) mk_conn_write, - (void *) mk_conn_error, - (void *) mk_conn_close, - (void *) mk_conn_timeout); - - thinfo = &sched_list[wid]; - - /* Rename worker */ - mk_string_build(&thread_name, &len, "monkey: wrk/%i", thinfo->idx); - mk_utils_worker_rename(thread_name); - mk_mem_free(thread_name); - - /* Export known scheduler node to context thread */ - pthread_setspecific(worker_sched_node, (void *) thinfo); - - /* Init epoll_wait() loop */ - mk_epoll_init(thinfo->epoll_fd, handler, epoll_max_events); - - return 0; -} - /* Register thread information. The caller thread is the thread information's owner */ -int mk_sched_register_thread(int efd) +static int mk_sched_register_thread(int efd) { - int i; + unsigned int i; struct sched_connection *sched_conn, *array; struct sched_list_node *sl; static int wid = 0; @@ -261,6 +212,55 @@ int mk_sched_register_thread(int efd) return sl->idx; } +/* created thread, all this calls are in the thread context */ +static void *mk_sched_launch_worker_loop(void *thread_conf) +{ + char *thread_name = 0; + unsigned long len; + sched_thread_conf *thconf = thread_conf; + int wid, epoll_max_events = thconf->epoll_max_events; + struct sched_list_node *thinfo = NULL; + mk_epoll_handlers *handler; + + /* Avoid SIGPIPE signals */ + mk_signal_thread_sigpipe_safe(); + + /* Init specific thread cache */ + mk_sched_thread_lists_init(); + mk_cache_thread_init(); + + /* Register working thread */ + wid = mk_sched_register_thread(thconf->epoll_fd); + mk_mem_free(thread_conf); + + /* Plugin thread context calls */ + mk_epoll_state_init(); + mk_plugin_event_init_list(); + mk_plugin_core_thread(); + + /* Epoll event handlers */ + handler = mk_epoll_set_handlers((void *) mk_conn_read, + (void *) mk_conn_write, + (void *) mk_conn_error, + (void *) mk_conn_close, + (void *) mk_conn_timeout); + + thinfo = &sched_list[wid]; + + /* Rename worker */ + mk_string_build(&thread_name, &len, "monkey: wrk/%i", thinfo->idx); + mk_utils_worker_rename(thread_name); + mk_mem_free(thread_name); + + /* Export known scheduler node to context thread */ + pthread_setspecific(worker_sched_node, (void *) thinfo); + + /* Init epoll_wait() loop */ + mk_epoll_init(thinfo->epoll_fd, handler, epoll_max_events); + + return 0; +} + /* * Create thread which will be listening * for incomings file descriptors -- 1.7.2.1
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
