X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fms_thread.h;h=8cb98bde97461c6ceb9b6d32668e0df5b5463516;hb=220ac91be6530bd992a7d2bde4310bb523075143;hp=2fa13d574a65325a63a881a608712d8fd32f98d4;hpb=ea32b463888ecfd7525eb88859cc2bb4af9b24d3;p=awesomized%2Flibmemcached diff --git a/clients/ms_thread.h b/clients/ms_thread.h index 2fa13d57..8cb98bde 100644 --- a/clients/ms_thread.h +++ b/clients/ms_thread.h @@ -35,38 +35,42 @@ extern "C" { #endif /** Time relative to server start. Smaller than time_t on 64-bit systems. */ -typedef unsigned int rel_time_t; +typedef unsigned int rel_time_t; /* Used to store the context of each thread */ -typedef struct thread_ctx { - int thd_idx; /* the thread index */ - int nconns; /* how many connections included by the thread */ - int srv_idx; /* index of the thread */ - int tps_perconn; /* expected throughput per connection */ - int64_t exec_num_perconn; /* execute number per connection */ +typedef struct thread_ctx +{ + uint32_t thd_idx; /* the thread index */ + uint32_t nconns; /* how many connections included by the thread */ + uint32_t srv_idx; /* index of the thread */ + int tps_perconn; /* expected throughput per connection */ + int64_t exec_num_perconn; /* execute number per connection */ } ms_thread_ctx_t; /* Used to store the private variables of each thread */ -typedef struct thread { - ms_conn_t *conn; /* conn array to store all the conn in the thread */ - int nactive_conn; /* how many connects are active */ +typedef struct thread +{ + ms_conn_t *conn; /* conn array to store all the conn in the thread */ + uint32_t nactive_conn; /* how many connects are active */ - ms_thread_ctx_t *thread_ctx; /* thread context from the caller */ - struct event_base *base; /* libevent handler created by this thread */ + ms_thread_ctx_t *thread_ctx; /* thread context from the caller */ + struct event_base *base; /* libevent handler created by this thread */ - rel_time_t curr_time; /* current time */ - struct event clock_event; /* clock event to time each one second */ - bool initialized; /* whether clock_event has been initialized */ + rel_time_t curr_time; /* current time */ + struct event clock_event; /* clock event to time each one second */ + bool initialized; /* whether clock_event has been initialized */ - struct timeval startup_time; /* start time of the thread */ + struct timeval startup_time; /* start time of the thread */ } ms_thread_t; /* initialize threads */ void ms_thread_init(void); + /* cleanup some resource of threads when all the threads exit */ void ms_thread_cleanup(void); + #ifdef __cplusplus } #endif