diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 5073ce66..6df06df5 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -236,8 +236,7 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att sigset_t set; if (!libc.can_do_threads) return ENOSYS; - self = __pthread_self(); //将进程id的值赋给主线程 - self->pid = __syscall(SYS_getpid); + self = __pthread_self(); if (!libc.threaded) { for (FILE *f=*__ofl_lock(); f; f=f->next) init_file_lock(f); @@ -360,7 +359,6 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att } if (ret >= 0) { - new->pid = self->pid; //新创建的线程获取进程id new->next = self->next; new->prev = self; new->next->prev = new; @@ -412,6 +410,6 @@ struct pthread* __pthread_list_find(pthread_t thread_id, const char* info) pid_t __pthread_gettid(pthread_t t) { struct pthread* thread = __pthread_list_find(t, "pthread_gettid"); - return thread ? thread->pid : -1; + return thread ? thread->tid : -1; } weak_alias(__pthread_gettid, pthread_gettid); \ No newline at end of file