From 860c34e3a6e0f5c2a0d352e82cd438eebdaf0652 Mon Sep 17 00:00:00 2001 From: Glenn Humphrey Date: Fri, 30 Nov 2007 20:34:13 +0000 Subject: 2007-11-30 Glenn Humphrey * posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/semaphore.h, posix/src/cancel.c, posix/src/conddestroy.c, posix/src/condsignalsupp.c, posix/src/condwaitsupp.c, posix/src/keydelete.c, posix/src/keygetspecific.c, posix/src/keysetspecific.c, posix/src/mqueueclose.c, posix/src/mqueuegetattr.c, posix/src/mqueuenotify.c, posix/src/mqueuerecvsupp.c, posix/src/mqueuesendsupp.c, posix/src/mqueuesetattr.c, posix/src/mqueuetranslatereturncode.c, posix/src/mutexdestroy.c, posix/src/mutexgetprioceiling.c, posix/src/mutexinit.c, posix/src/mutexlocksupp.c, posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, posix/src/pbarrierdestroy.c, posix/src/pbarriertranslatereturncode.c, posix/src/pbarrierwait.c, posix/src/prwlockdestroy.c, posix/src/prwlockrdlock.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/prwlocktranslatereturncode.c, posix/src/prwlocktryrdlock.c, posix/src/prwlocktrywrlock.c, posix/src/prwlockunlock.c, posix/src/prwlockwrlock.c, posix/src/pspindestroy.c, posix/src/pspinlock.c, posix/src/pspinlocktranslatereturncode.c, posix/src/pspintrylock.c, posix/src/pspinunlock.c, posix/src/pthreaddetach.c, posix/src/pthreadequal.c, posix/src/pthreadgetschedparam.c, posix/src/pthreadjoin.c, posix/src/pthreadkill.c, posix/src/pthreadsetschedparam.c, posix/src/ptimer1.c, posix/src/semaphorewaitsupp.c, posix/src/semclose.c, posix/src/semdestroy.c, posix/src/semgetvalue.c, posix/src/sempost.c, posix/src/types.c, rtems/src/msgqtranslatereturncode.c, rtems/src/semobtain.c, rtems/src/timerfireafter.c, score/include/rtems/system.h, score/include/rtems/score/corebarrier.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h: Restructed to move the OBJECTS_LOCAL case to the top of the switch statement and eliminate the fall-through return of POSIX_BOTTOM_REACHED. These changes produced simplier assembly code and allowed for complete test coverage. Also applied some consistency to the functions that translate the core status codes to POSIX status codes. * posix/src/mutextranslatereturncode.c, posix/src/semaphoretranslatereturncode.c: New files. * posix/src/mutexfromcorestatus.c: Removed. --- cpukit/posix/src/pthreadequal.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'cpukit/posix/src/pthreadequal.c') diff --git a/cpukit/posix/src/pthreadequal.c b/cpukit/posix/src/pthreadequal.c index 86db43767a..8d82d8d545 100644 --- a/cpukit/posix/src/pthreadequal.c +++ b/cpukit/posix/src/pthreadequal.c @@ -53,12 +53,6 @@ int pthread_equal( (void) _POSIX_Threads_Get( t1, &location ); switch ( location ) { -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: -#endif - case OBJECTS_ERROR: - /* return status == 0 */ - break; case OBJECTS_LOCAL: @@ -68,20 +62,30 @@ int pthread_equal( (void) _POSIX_Threads_Get( t2, &location ); switch ( location ) { + + case OBJECTS_LOCAL: + status = _Objects_Are_ids_equal( t1, t2 ); + _Thread_Unnest_dispatch(); + _Thread_Enable_dispatch(); + break; + case OBJECTS_ERROR: case OBJECTS_REMOTE: /* t1 must have been valid so exit the critical section */ _Thread_Enable_dispatch(); /* return status == 0 */ break; - case OBJECTS_LOCAL: - status = _Objects_Are_ids_equal( t1, t2 ); - _Thread_Unnest_dispatch(); - _Thread_Enable_dispatch(); - break; } break; + +#if defined(RTEMS_MULTIPROCESSING) + case OBJECTS_REMOTE: +#endif + case OBJECTS_ERROR: + /* return status == 0 */ + break; } + return status; #endif } -- cgit v1.2.3