diff options
author | Mark Johannes <Mark.Johannes@OARcorp.com> | 1996-08-12 17:21:04 +0000 |
---|---|---|
committer | Mark Johannes <Mark.Johannes@OARcorp.com> | 1996-08-12 17:21:04 +0000 |
commit | cdcea6ceb6b2b75d64059aac2f9436e1d51ba629 (patch) | |
tree | 5f18c2b445329e53ff249a28ca3af5251aca05a8 /cpukit/posix/src | |
parent | pthread_mutexattr_setprioceiling: fixed typo (diff) | |
download | rtems-cdcea6ceb6b2b75d64059aac2f9436e1d51ba629.tar.bz2 |
_POSIX_Condition_variables_Signal_support: added setting mutex back to NULL
if the queue has been emptied of waiting tasks.
_POSIX_Condition_variables_Wait_support: added error check for different mutexesfor the same condition variable. Also added _Thread_queue_Enter_critical_section
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r-- | cpukit/posix/src/cond.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cpukit/posix/src/cond.c b/cpukit/posix/src/cond.c index 68ef709be1..03f2b67577 100644 --- a/cpukit/posix/src/cond.c +++ b/cpukit/posix/src/cond.c @@ -199,7 +199,7 @@ int pthread_cond_init( the_cond->process_shared = the_attr->process_shared; - the_cond->Mutex = 0; + the_cond->Mutex = (unsigned32) NULL; /* XXX some more initialization might need to go here */ _Thread_queue_Initialize( @@ -314,6 +314,8 @@ int _POSIX_Condition_variables_Signal_support( do { the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue ); + if ( !the_thread ) + the_cond->Mutex = (unsigned32) NULL; } while ( is_broadcast && the_thread ); return 0; } @@ -372,9 +374,8 @@ int _POSIX_Condition_variables_Wait_support( return EINVAL; case OBJECTS_LOCAL: - /* - * XXX: should be an error if cond->Mutex != mutex - */ + if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) ) + return EINVAL; status = pthread_mutex_unlock( mutex ); if ( !status ) @@ -382,7 +383,8 @@ int _POSIX_Condition_variables_Wait_support( the_cond->Mutex = *mutex; -/* XXX .. enter critical section .. */ + _Thread_queue_Enter_critical_section( &the_cond->Wait_queue ); + _Thread_queue_Enqueue( &the_cond->Wait_queue, 0 ); _Thread_Enable_dispatch(); |