ChinaUnix.net
相关文章推荐:

gettid

编译helix server 时出现: _main.cpp:80: error: ‘gettid’ has not been declared 源码为: #ifdef _LINUX #include #include #if defined PTHREADS_SUPPORTED //pid_t gettid(void) { return syscall(__NR_gettid); } _syscall0(pid_t,gettid) /***********************line 80*************/ #endif // PTHREADS_SUPPORTED #endif // _LINUX 请问怎么解决?

by lee51525125 - Linux系统管理 - 2009-06-03 22:06:13 阅读(2020) 回复(2)

相关讨论

请问这两个函数或系统调用是不是一回事?我这里它们的返回值是不等的。 比如下面这个程序: [code] #define _GNU_SOURCE #include #include #include #include #include #include #include void *thsf(void *arg){ pthread_t th; char *retstr; retstr=malloc(50); memset(retstr,0,50); strcp...

by hohoxu_hao115 - C/C++ - 2007-07-16 13:52:21 阅读(4991) 回复(2)

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...

by todaygood - Linux文档专区 - 2008-11-30 09:08:55 阅读(1271) 回复(0)

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...

by todaygood - Linux文档专区 - 2008-11-30 09:08:24 阅读(2305) 回复(0)

linux多线程环境下gettid() pthread_self() 两个函数都获得线程ID linux使用进程模拟线程,gettid 函数返回实际的进程ID pthread_self 函数返回 pthread_create创建线程时的ID, 我就有点迷惑, 到底那个是线程的ID呢,一个线程不能有两个ID吧 我测试 pthread_self 函数返回的是一个地址,例如: pid 967--tid 967-- pthread_self b7f5c6c0 请大家答疑解惑了

by tianhailong - C/C++ - 2013-09-05 10:09:27 阅读(20847) 回复(13)

代码如下: #include #include #include #include #include #include void *handler(void *arg) { printf("tid = %x pid = %d \n",gettid(),getpid()); return NULL; } int main() { pthread_t tid; int ret = pthread_create(&tid,NULL,handler,NULL); if(ret) { fprintf(stderr,"%s\n",strerror(ret)); exit(...

by aaron_xueli - C/C++ - 2010-09-30 14:11:05 阅读(4573) 回复(5)