diff options
author | Nicolas Planel <nplanel@mandriva.com> | 2003-10-29 16:07:11 +0000 |
---|---|---|
committer | Nicolas Planel <nplanel@mandriva.com> | 2003-10-29 16:07:11 +0000 |
commit | de47eb59bb829423b1d0f47ba13099073999b3cb (patch) | |
tree | 827f35c4666e15ec66edae7c1fa05d963324602b /mdk-stage1/dietlibc/libpthread/pthread_create.c | |
parent | 1fece42e9c460ca017fc4facad380f05163d8977 (diff) | |
download | drakx-backup-do-not-use-topic/Corpo_2_1.tar drakx-backup-do-not-use-topic/Corpo_2_1.tar.gz drakx-backup-do-not-use-topic/Corpo_2_1.tar.bz2 drakx-backup-do-not-use-topic/Corpo_2_1.tar.xz drakx-backup-do-not-use-topic/Corpo_2_1.zip |
Corporate Server 2.1.1 releasetopic/Corpo_2_1
Diffstat (limited to 'mdk-stage1/dietlibc/libpthread/pthread_create.c')
-rw-r--r-- | mdk-stage1/dietlibc/libpthread/pthread_create.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_create.c b/mdk-stage1/dietlibc/libpthread/pthread_create.c index b4a499081..714c2bf4b 100644 --- a/mdk-stage1/dietlibc/libpthread/pthread_create.c +++ b/mdk-stage1/dietlibc/libpthread/pthread_create.c @@ -15,21 +15,20 @@ int pthread_create (pthread_t *thread, const pthread_attr_t *attr, __THREAD_INIT(); if (start_routine==0) { - (*(__errno_location()))=EINVAL; - return -1; + return EINVAL; } td = __thread_get_free(); if (td) { + td->go.__spinlock=PTHREAD_SPIN_LOCKED; if (!(attr)) { pthread_attr_init(&default_attr); attr=&default_attr; } if ((td->policy!=SCHED_OTHER)&&(td->priority==0)) { - (*(__errno_location()))=EINVAL; - return -1; + return EINVAL; } if (attr->__inheritsched==PTHREAD_INHERIT_SCHED) { @@ -48,14 +47,17 @@ int pthread_create (pthread_t *thread, const pthread_attr_t *attr, td->stack_size = attr->__stacksize; - if (!(td->stack_addr)) { + if (!(attr->__stackaddr)) { char *stack=(char*)malloc(td->stack_size); if (!(stack)) { - (*(__errno_location()))=EINVAL; - return -1; + return EINVAL; } td->stack_begin = stack; +#ifdef __parisc__ + td->stack_addr = stack; +#else td->stack_addr = stack+td->stack_size; +#endif } else { td->stack_begin = 0; td->stack_addr = attr->__stackaddr; @@ -65,12 +67,15 @@ int pthread_create (pthread_t *thread, const pthread_attr_t *attr, if (ret>1) *thread=ret; - else + else { + ++td->exited; /* mark as exited */ __thread_cleanup(td); + if (ret<0) return (*(__errno_location())); + return EAGAIN; + } } else - (*(__errno_location()))=EAGAIN; + return EAGAIN; - if (ret<2) return -1; - return ret; + return 0; } |