add function fc_gettid

posix_api
YuQing 2022-01-29 15:56:41 +08:00
parent 505893dc4c
commit 4b9e2d6517
2 changed files with 22 additions and 0 deletions

View File

@ -1,4 +1,7 @@
Version 1.56 2022-01-29
* add function fc_gettid
Version 1.55 2022-01-12
* fastcommon php extension adapt to php 8
* function fast_mblock_batch_alloc changed

View File

@ -19,11 +19,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "common_define.h"
#ifdef OS_LINUX
#include <sys/syscall.h>
#endif
#include "fc_memory.h"
#include "ini_file_reader.h"
@ -1212,6 +1216,21 @@ static inline int fc_check_realloc_iovec_array(
return 0;
}
static inline pid_t fc_gettid()
{
#ifdef OS_LINUX
#ifdef SYS_gettid
return (pid_t)syscall(SYS_gettid);
#else
return getpid();
#endif
#else
return getpid();
#endif
}
#ifdef __cplusplus
}
#endif