Kouhei Sutou
null+****@clear*****
Thu Oct 30 20:26:48 JST 2014
Kouhei Sutou 2014-10-30 20:26:48 +0900 (Thu, 30 Oct 2014) New Revision: 1e737e7426ae4d1bf98962aadb92b9c16261423f https://github.com/groonga/groonga/commit/1e737e7426ae4d1bf98962aadb92b9c16261423f Message: Unify thread func return value Modified files: lib/grn.h src/grnslap.c src/groonga.c Modified: lib/grn.h (+4 -0) =================================================================== --- lib/grn.h 2014-10-30 20:11:09 +0900 (ddba348) +++ lib/grn.h 2014-10-30 20:26:48 +0900 (8296ed4) @@ -240,6 +240,8 @@ typedef int grn_sock; #ifdef HAVE_PTHREAD_H # include <pthread.h> typedef pthread_t grn_thread; +typedef void * grn_thread_func_result; +# define GRN_THREAD_FUNC_RETURN_VALUE NULL # define THREAD_CREATE(thread,func,arg) \ (pthread_create(&(thread), NULL, (func), (arg))) # define THREAD_JOIN(thread) (pthread_join(thread, NULL)) @@ -330,6 +332,8 @@ typedef int grn_thread_key; # ifdef WIN32 typedef uintptr_t grn_thread; +typedef unsigned int grn_thread_func_result; +# define GRN_THREAD_FUNC_RETURN_VALUE 0 # define THREAD_CREATE(thread,func,arg) \ (((thread)=_beginthreadex(NULL, 0, (func), (arg), 0, NULL)) == NULL) # define THREAD_JOIN(thread) \ Modified: src/grnslap.c (+2 -2) =================================================================== --- src/grnslap.c 2014-10-30 20:11:09 +0900 (88bf168) +++ src/grnslap.c 2014-10-30 20:26:48 +0900 (d2c5049) @@ -196,7 +196,7 @@ msg_handler(grn_ctx *ctx, grn_obj *msg) grn_msg_close(ctx, msg); } -static void * CALLBACK +static grn_thread_func_result CALLBACK receiver(void *arg) { grn_ctx ctx_, *ctx = &ctx_; @@ -213,7 +213,7 @@ receiver(void *arg) */ } grn_ctx_fin(ctx); - return NULL; + return GRN_THREAD_FUNC_RETURN_VALUE; } static int Modified: src/groonga.c (+4 -4) =================================================================== --- src/groonga.c 2014-10-30 20:11:09 +0900 (c504cc9) +++ src/groonga.c 2014-10-30 20:26:48 +0900 (a1064b2) @@ -1655,7 +1655,7 @@ check_rlimit_nofile(grn_ctx *ctx) #endif /* WIN32 */ } -static void * CALLBACK +static grn_thread_func_result CALLBACK h_worker(void *arg) { ht_context hc; @@ -1686,7 +1686,7 @@ exit : MUTEX_UNLOCK(q_mutex); GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)", nfthreads, nthreads); grn_ctx_fin(ctx); - return NULL; + return GRN_THREAD_FUNC_RETURN_VALUE; } static void @@ -1731,7 +1731,7 @@ h_server(char *path) return exit_code; } -static void * CALLBACK +static grn_thread_func_result CALLBACK g_worker(void *arg) { GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread start (%d/%d)", nfthreads, nthreads + 1); @@ -1792,7 +1792,7 @@ exit : nthreads--; MUTEX_UNLOCK(q_mutex); GRN_LOG(&grn_gctx, GRN_LOG_NOTICE, "thread end (%d/%d)", nfthreads, nthreads); - return NULL; + return GRN_THREAD_FUNC_RETURN_VALUE; } static void -------------- next part -------------- HTML����������������������������... 다운로드