Changeset cdcea6ce in rtems


Ignore:
Timestamp:
08/12/96 17:21:04 (27 years ago)
Author:
Mark Johannes <Mark.Johannes@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
af04a791
Parents:
f126ae2
Message:

_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

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/cond.c

    rf126ae2 rcdcea6ce  
    200200  the_cond->process_shared  = the_attr->process_shared;
    201201
    202   the_cond->Mutex = 0;
     202  the_cond->Mutex = (unsigned32) NULL;
    203203
    204204/* XXX some more initialization might need to go here */
     
    315315      do {
    316316        the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
     317        if ( !the_thread )
     318          the_cond->Mutex = (unsigned32) NULL;
    317319      } while ( is_broadcast && the_thread );
    318320      return 0;
     
    373375    case OBJECTS_LOCAL:
    374376 
    375       /*
    376        *  XXX: should be an error if cond->Mutex != mutex
    377        */
     377      if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) )
     378        return EINVAL;
    378379 
    379380      status = pthread_mutex_unlock( mutex );
     
    383384      the_cond->Mutex = *mutex;
    384385 
    385 /* XXX .. enter critical section .. */
     386      _Thread_queue_Enter_critical_section( &the_cond->Wait_queue );
     387
    386388      _Thread_queue_Enqueue( &the_cond->Wait_queue, 0 );
    387389
  • cpukit/posix/src/cond.c

    rf126ae2 rcdcea6ce  
    200200  the_cond->process_shared  = the_attr->process_shared;
    201201
    202   the_cond->Mutex = 0;
     202  the_cond->Mutex = (unsigned32) NULL;
    203203
    204204/* XXX some more initialization might need to go here */
     
    315315      do {
    316316        the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
     317        if ( !the_thread )
     318          the_cond->Mutex = (unsigned32) NULL;
    317319      } while ( is_broadcast && the_thread );
    318320      return 0;
     
    373375    case OBJECTS_LOCAL:
    374376 
    375       /*
    376        *  XXX: should be an error if cond->Mutex != mutex
    377        */
     377      if ( the_cond->Mutex && ( the_cond->Mutex != *mutex ) )
     378        return EINVAL;
    378379 
    379380      status = pthread_mutex_unlock( mutex );
     
    383384      the_cond->Mutex = *mutex;
    384385 
    385 /* XXX .. enter critical section .. */
     386      _Thread_queue_Enter_critical_section( &the_cond->Wait_queue );
     387
    386388      _Thread_queue_Enqueue( &the_cond->Wait_queue, 0 );
    387389
Note: See TracChangeset for help on using the changeset viewer.