diff options
| -rw-r--r-- | lib/libc_r/uthread/uthread_cond.c | 20 | ||||
| -rw-r--r-- | lib/libc_r/uthread/uthread_mutex.c | 20 | ||||
| -rw-r--r-- | lib/libkse/thread/thr_cond.c | 20 | ||||
| -rw-r--r-- | lib/libkse/thread/thr_mutex.c | 20 | ||||
| -rw-r--r-- | lib/libpthread/thread/thr_cond.c | 20 | ||||
| -rw-r--r-- | lib/libpthread/thread/thr_mutex.c | 20 | 
6 files changed, 96 insertions, 24 deletions
| diff --git a/lib/libc_r/uthread/uthread_cond.c b/lib/libc_r/uthread/uthread_cond.c index 978ad045db68..e7fcc62e155c 100644 --- a/lib/libc_r/uthread/uthread_cond.c +++ b/lib/libc_r/uthread/uthread_cond.c @@ -134,9 +134,15 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex)  	int             rval = 0;  	int             status; -	if (cond == NULL || *cond == NULL) { +	if (cond == NULL)  		rval = EINVAL; -	} else { + +	/* +	 * If the condition variable is statically initialized, +	 * perform the dynamic initialization: +	 */ +	else if (*cond != NULL || +	    (rval = pthread_cond_init(cond,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); @@ -189,9 +195,15 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,  	int             rval = 0;  	int             status; -	if (cond == NULL || *cond == NULL) { +	if (cond == NULL)  		rval = EINVAL; -	} else { + +	/* +	 * If the condition variable is statically initialized, +	 * perform the dynamic initialization: +	 */ +	else if (*cond != NULL || +	    (rval = pthread_cond_init(cond,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); diff --git a/lib/libc_r/uthread/uthread_mutex.c b/lib/libc_r/uthread/uthread_mutex.c index e6be6def2726..9f92de9eb3e8 100644 --- a/lib/libc_r/uthread/uthread_mutex.c +++ b/lib/libc_r/uthread/uthread_mutex.c @@ -162,9 +162,15 @@ pthread_mutex_trylock(pthread_mutex_t * mutex)  	int             ret = 0;  	int             status; -	if (mutex == NULL || *mutex == NULL) { +	if (mutex == NULL)  		ret = EINVAL; -	} else { + +	/* +	 * If the mutex is statically initialized, perform the dynamic +	 * initialization: +	 */ +	else if (*mutex != NULL || +	    (ret = pthread_mutex_init(mutex,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); @@ -224,9 +230,15 @@ pthread_mutex_lock(pthread_mutex_t * mutex)  	int             ret = 0;  	int             status; -	if (mutex == NULL || *mutex == NULL) { +	if (mutex == NULL)  		ret = EINVAL; -	} else { + +	/* +	 * If the mutex is statically initialized, perform the dynamic +	 * initialization: +	 */ +	else if (*mutex != NULL || +	    (ret = pthread_mutex_init(mutex,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c index 978ad045db68..e7fcc62e155c 100644 --- a/lib/libkse/thread/thr_cond.c +++ b/lib/libkse/thread/thr_cond.c @@ -134,9 +134,15 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex)  	int             rval = 0;  	int             status; -	if (cond == NULL || *cond == NULL) { +	if (cond == NULL)  		rval = EINVAL; -	} else { + +	/* +	 * If the condition variable is statically initialized, +	 * perform the dynamic initialization: +	 */ +	else if (*cond != NULL || +	    (rval = pthread_cond_init(cond,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); @@ -189,9 +195,15 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,  	int             rval = 0;  	int             status; -	if (cond == NULL || *cond == NULL) { +	if (cond == NULL)  		rval = EINVAL; -	} else { + +	/* +	 * If the condition variable is statically initialized, +	 * perform the dynamic initialization: +	 */ +	else if (*cond != NULL || +	    (rval = pthread_cond_init(cond,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c index e6be6def2726..9f92de9eb3e8 100644 --- a/lib/libkse/thread/thr_mutex.c +++ b/lib/libkse/thread/thr_mutex.c @@ -162,9 +162,15 @@ pthread_mutex_trylock(pthread_mutex_t * mutex)  	int             ret = 0;  	int             status; -	if (mutex == NULL || *mutex == NULL) { +	if (mutex == NULL)  		ret = EINVAL; -	} else { + +	/* +	 * If the mutex is statically initialized, perform the dynamic +	 * initialization: +	 */ +	else if (*mutex != NULL || +	    (ret = pthread_mutex_init(mutex,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); @@ -224,9 +230,15 @@ pthread_mutex_lock(pthread_mutex_t * mutex)  	int             ret = 0;  	int             status; -	if (mutex == NULL || *mutex == NULL) { +	if (mutex == NULL)  		ret = EINVAL; -	} else { + +	/* +	 * If the mutex is statically initialized, perform the dynamic +	 * initialization: +	 */ +	else if (*mutex != NULL || +	    (ret = pthread_mutex_init(mutex,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); diff --git a/lib/libpthread/thread/thr_cond.c b/lib/libpthread/thread/thr_cond.c index 978ad045db68..e7fcc62e155c 100644 --- a/lib/libpthread/thread/thr_cond.c +++ b/lib/libpthread/thread/thr_cond.c @@ -134,9 +134,15 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex)  	int             rval = 0;  	int             status; -	if (cond == NULL || *cond == NULL) { +	if (cond == NULL)  		rval = EINVAL; -	} else { + +	/* +	 * If the condition variable is statically initialized, +	 * perform the dynamic initialization: +	 */ +	else if (*cond != NULL || +	    (rval = pthread_cond_init(cond,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); @@ -189,9 +195,15 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,  	int             rval = 0;  	int             status; -	if (cond == NULL || *cond == NULL) { +	if (cond == NULL)  		rval = EINVAL; -	} else { + +	/* +	 * If the condition variable is statically initialized, +	 * perform the dynamic initialization: +	 */ +	else if (*cond != NULL || +	    (rval = pthread_cond_init(cond,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index e6be6def2726..9f92de9eb3e8 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -162,9 +162,15 @@ pthread_mutex_trylock(pthread_mutex_t * mutex)  	int             ret = 0;  	int             status; -	if (mutex == NULL || *mutex == NULL) { +	if (mutex == NULL)  		ret = EINVAL; -	} else { + +	/* +	 * If the mutex is statically initialized, perform the dynamic +	 * initialization: +	 */ +	else if (*mutex != NULL || +	    (ret = pthread_mutex_init(mutex,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); @@ -224,9 +230,15 @@ pthread_mutex_lock(pthread_mutex_t * mutex)  	int             ret = 0;  	int             status; -	if (mutex == NULL || *mutex == NULL) { +	if (mutex == NULL)  		ret = EINVAL; -	} else { + +	/* +	 * If the mutex is statically initialized, perform the dynamic +	 * initialization: +	 */ +	else if (*mutex != NULL || +	    (ret = pthread_mutex_init(mutex,NULL)) == 0) {  		/* Block signals: */  		_thread_kern_sig_block(&status); | 
