mirror of
https://github.com/openharmony/third_party_musl2.git
synced 2026-07-01 10:25:07 -04:00
update src/thread/pthread_create.c.
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user