function create_work_threads changed
parent
414f20fa61
commit
b7dde81d1e
3
HISTORY
3
HISTORY
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
Version 1.42 2019-11-30
|
||||
Version 1.42 2019-12-03
|
||||
* add function get_gzip_command_filename
|
||||
* function create_work_threads changed
|
||||
|
||||
Version 1.41 2019-09-30
|
||||
* change CIDR network_bits range from [16, 32) to [10, 32)
|
||||
|
|
|
|||
|
|
@ -136,11 +136,12 @@ int init_pthread_attr(pthread_attr_t *pattr, const int stack_size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int create_work_threads(int *count, void *(*start_func)(void *), \
|
||||
void *arg, pthread_t *tids, const int stack_size)
|
||||
int create_work_threads(int *count, void *(*start_func)(void *),
|
||||
void **args, pthread_t *tids, const int stack_size)
|
||||
{
|
||||
int result;
|
||||
pthread_attr_t thread_attr;
|
||||
void **current_arg;
|
||||
pthread_t *ptid;
|
||||
pthread_t *ptid_end;
|
||||
|
||||
|
|
@ -151,16 +152,16 @@ int create_work_threads(int *count, void *(*start_func)(void *), \
|
|||
|
||||
result = 0;
|
||||
ptid_end = tids + (*count);
|
||||
for (ptid=tids; ptid<ptid_end; ptid++)
|
||||
for (ptid=tids,current_arg=args; ptid<ptid_end; ptid++,current_arg++)
|
||||
{
|
||||
if ((result=pthread_create(ptid, &thread_attr, \
|
||||
start_func, arg)) != 0)
|
||||
if ((result=pthread_create(ptid, &thread_attr,
|
||||
start_func, *current_arg)) != 0)
|
||||
{
|
||||
*count = ptid - tids;
|
||||
logError("file: "__FILE__", line: %d, " \
|
||||
"create thread failed, startup threads: %d, " \
|
||||
"errno: %d, error info: %s", \
|
||||
__LINE__, *count, \
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"create threads #%d fail, "
|
||||
"errno: %d, error info: %s",
|
||||
__LINE__, *count,
|
||||
result, STRERROR(result));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ extern "C" {
|
|||
int init_pthread_lock(pthread_mutex_t *pthread_lock);
|
||||
int init_pthread_attr(pthread_attr_t *pattr, const int stack_size);
|
||||
|
||||
int create_work_threads(int *count, void *(*start_func)(void *), \
|
||||
void *arg, pthread_t *tids, const int stack_size);
|
||||
int create_work_threads(int *count, void *(*start_func)(void *),
|
||||
void **args, pthread_t *tids, const int stack_size);
|
||||
int kill_work_threads(pthread_t *tids, const int count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Reference in New Issue