set thread name as necessary
parent
9d9cee76ac
commit
082da383ff
3
HISTORY
3
HISTORY
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
Version 1.50 2021-04-28
|
||||
Version 1.50 2021-04-29
|
||||
* add function is_digital_string
|
||||
* add function fc_server_load_from_ini_context
|
||||
* set thread name as necessary
|
||||
|
||||
Version 1.49 2021-04-17
|
||||
* add macros: FC_ABS and FC_NEGATIVE
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef OS_LINUX
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include "shared_func.h"
|
||||
#include "pthread_func.h"
|
||||
#include "logger.h"
|
||||
|
|
@ -377,6 +382,10 @@ static void *sched_call_func(void *args)
|
|||
TaskFunc task_func;
|
||||
int task_id;
|
||||
|
||||
#ifdef OS_LINUX
|
||||
prctl(PR_SET_NAME, "sched-call");
|
||||
#endif
|
||||
|
||||
pEntry = (ScheduleEntry *)args;
|
||||
task_func = pEntry->task_func;
|
||||
func_args = pEntry->func_args;
|
||||
|
|
@ -405,6 +414,10 @@ static void *sched_thread_entrance(void *args)
|
|||
int exec_count;
|
||||
int i;
|
||||
|
||||
#ifdef OS_LINUX
|
||||
prctl(PR_SET_NAME, "sched");
|
||||
#endif
|
||||
|
||||
pContext = (ScheduleContext *)args;
|
||||
if (sched_init_entries(pContext->scheduleArray.entries,
|
||||
pContext->scheduleArray.count) != 0)
|
||||
|
|
@ -852,6 +865,10 @@ static void *sched_call_delay_func(void *args)
|
|||
ScheduleContext *pContext;
|
||||
FastDelayTask *task;
|
||||
|
||||
#ifdef OS_LINUX
|
||||
prctl(PR_SET_NAME, "sched-delay");
|
||||
#endif
|
||||
|
||||
delay_context = (struct delay_thread_context *)args;
|
||||
task = delay_context->task;
|
||||
pContext = delay_context->schedule_context;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@
|
|||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef OS_LINUX
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include "sched_thread.h"
|
||||
#include "fc_memory.h"
|
||||
#include "thread_pool.h"
|
||||
|
|
@ -36,6 +41,15 @@ static void *thread_entrance(void *arg)
|
|||
thread = (FCThreadInfo *)arg;
|
||||
pool = thread->pool;
|
||||
|
||||
#ifdef OS_LINUX
|
||||
{
|
||||
char thread_name[64];
|
||||
snprintf(thread_name, sizeof(thread_name), "%s[%d]",
|
||||
pool->name, thread->index);
|
||||
prctl(PR_SET_NAME, thread_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pool->extra_data_callbacks.alloc != NULL) {
|
||||
thread->tdata = pool->extra_data_callbacks.alloc();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue