Bläddra i källkod

fix joinable semaphore of pthread not clear to NULL when detach.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1337 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 14 år sedan
förälder
incheckning
e9148ab6c7
2 ändrade filer med 3 tillägg och 2 borttagningar
  1. 2 1
      components/pthreads/pthread.c
  2. 1 1
      components/pthreads/pthread.h

+ 2 - 1
components/pthreads/pthread.c

@@ -180,10 +180,11 @@ int pthread_detach(pthread_t thread)
 		rt_enter_critical();
 		/* change to detach state */
 		ptd->attr.detachstate = PTHREAD_CREATE_DETACHED;
-		rt_exit_critical();
 
 		/* detach joinable semaphore */
 		rt_sem_delete(ptd->joinable_sem);
+		ptd->joinable_sem = RT_NULL;
+		rt_exit_critical();
 	}
 
 	return 0;

+ 1 - 1
components/pthreads/pthread.h

@@ -129,7 +129,7 @@ typedef struct pthread_barrier pthread_barrier_t;
 int pthread_attr_destroy(pthread_attr_t *attr);
 int pthread_attr_init(pthread_attr_t *attr);
 
-int pthread_init (void);
+int pthread_system_init(void);
 int pthread_create (pthread_t *tid, const pthread_attr_t *attr, 
 	void *(*start) (void *), void *arg);