PID和TID
帖子的PID和TID是什么呢? 怎样查看? https://fishc.com.cn/forum.php?mod=viewthread&tid=223338&extra=page%3D1&ordertype=1tid 有发现
pid木有发现 pid - process identifier
tid - thread identifier
人造人 发表于 2023-1-12 16:09
pid - process identifier
tid - thread identifier
???怎么查看 KeyError 发表于 2023-1-12 18:09
???怎么查看
sh-5.1$ cat main.c
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
void *task(void *arg) {
printf("task - arg: %d\n", *(int *)arg);
printf("task - pid: %x\n", getpid());
printf("task - tid: %lx\n", pthread_self());
return arg;
}
int main(void) {
printf("main - pid: %x\n", getpid());
printf("main - tid: %lx\n", pthread_self());
pthread_t t0, t1;
int a = 123, b = 456;
pthread_create(&t0, NULL, task, &a);
pthread_create(&t1, NULL, task, &b);
pthread_join(t0, NULL);
pthread_join(t1, NULL);
return 0;
}
sh-5.1$ gcc -g -Wall -o main main.c
sh-5.1$ ./main
main - pid: aa736
main - tid: 7f55fc8b9680
task - arg: 456
task - pid: aa736
task - tid: 7f55fbecd6c0
task - arg: 123
task - pid: aa736
task - tid: 7f55fc6ce6c0
sh-5.1$
人造人 发表于 2023-1-12 18:34
{:10_257:}
......
我说的是在浏览器里...... KeyError 发表于 2023-1-12 18:36
......
我说的是在浏览器里......
https://cn.bing.com/search?form=MOZLBR&pc=MOZI&q=pid+tid
页:
[1]