头文件要有:
#include <unistd.h> #include <pthread.h> #include <sys/syscall.h> #include <sys/prctl.h>
程序:
printf(" tid : %d \n", syscall(224));
prctl(PR_SET_NAME, "test_Thread");
运行后
ps 结果:
当 不是多线,则 pid = tid ;
头文件要有:
#include <unistd.h> #include <pthread.h> #include <sys/syscall.h> #include <sys/prctl.h>
程序:
printf(" tid : %d \n", syscall(224));
prctl(PR_SET_NAME, "test_Thread");
运行后
ps 结果:
当 不是多线,则 pid = tid ;