编译helix server 时出现:
_main.cpp:80: error: ‘gettid’ has not been declared
源码为:
#ifdef _LINUX
#include
by lee51525125 - Linux系统管理 - 2009-06-03 22:06:13 阅读(2020) 回复(2)
请问这两个函数或系统调用是不是一回事?我这里它们的返回值是不等的。
比如下面这个程序:
[code]
#define _GNU_SOURCE
#include
gettid 和pthread_self的区别 The man page for gettid says: The thread ID returned by this call is not the same thing as a POSIX thread ID (i.e., the opaque value returned by pthread_self(3)). 看来,线程的id,在linux中分为POSIX thread ID , 和内核中对每一个线程的id. gettid是linux 的一个系统调用, 查看sys_gettid /* Thread ID - the internal kernel "pid" */ asmlinkage long sys_gettid(void) { return...
gettid 和pthread_self的区别 The man page for gettid says: The thread ID returned by this call is not the same thing as a POSIX thread ID (i.e., the opaque value returned by pthread_self(3)). 看来,线程的id,在linux中分为POSIX thread ID , 和内核中对每一个线程的id. gettid是linux 的一个系统调用, 查看sys_gettid /* Thread ID - the internal kernel "pid" */ asmlinkage long sys_gettid(void) { return...
linux多线程环境下gettid() pthread_self() 两个函数都获得线程ID linux使用进程模拟线程,gettid 函数返回实际的进程ID pthread_self 函数返回 pthread_create创建线程时的ID, 我就有点迷惑, 到底那个是线程的ID呢,一个线程不能有两个ID吧 我测试 pthread_self 函数返回的是一个地址,例如: pid 967--tid 967-- pthread_self b7f5c6c0 请大家答疑解惑了
代码如下:
#include