Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/ChangeLog	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -1,2 +1,9 @@
+2007-11-27	Glenn Humphrey <glenn.humphrey@OARcorp.com>
+
+	* posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c,
+	rtems/include/rtems/rtems/barrier.h,
+	score/src/corerwlockobtainread.c, score/src/corerwlockobtainwrite.c,
+	score/src/corerwlockrelease.c: Fixed several implementation errors.
+
 2007-11-27	Glenn Humphrey <glenn.humphrey@OARcorp.com>
 
Index: cpukit/posix/src/prwlocktimedrdlock.c
===================================================================
--- cpukit/posix/src/prwlocktimedrdlock.c	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/posix/src/prwlocktimedrdlock.c	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -50,5 +50,5 @@
 
   status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
-  if ( !status )
+  if ( status )
     return status;
 
Index: cpukit/posix/src/prwlocktimedwrlock.c
===================================================================
--- cpukit/posix/src/prwlocktimedwrlock.c	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/posix/src/prwlocktimedwrlock.c	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -50,5 +50,5 @@
 
   status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
-  if ( !status )
+  if ( status )
     return status;
 
Index: cpukit/rtems/include/rtems/rtems/barrier.h
===================================================================
--- cpukit/rtems/include/rtems/rtems/barrier.h	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/rtems/include/rtems/rtems/barrier.h	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -146,5 +146,4 @@
  *
  *  @param[in] id indicates the barrier to wait at.
- *  @param[in] option_set indicates if the caller is willing to wait.
  *  @param[in] timeout is the maximum length of time in ticks the calling
  *             thread is willing to block.
@@ -162,9 +161,9 @@
  *  This routine implements the rtems_barrier_release directive.  It
  *  unblocks all of the threads waiting on the barrier associated with
- *  @a id.  The number of threads unblocked is returns in @a unblocked.
+ *  @a id.  The number of threads unblocked is returned in @a released.
  *
  *
  *  @param[in] id indicates the barrier to wait at.
- *  @param[out] unblocked will contain the number of threads unblocked.
+ *  @param[out] released will contain the number of threads unblocked.
  *
  *  @return a status code indicating success or the reason for failure.
@@ -172,5 +171,5 @@
 rtems_status_code rtems_barrier_release(
   rtems_id  id,
-  uint32_t *unblocked
+  uint32_t *released
 );
 
Index: cpukit/score/src/corerwlockobtainread.c
===================================================================
--- cpukit/score/src/corerwlockobtainread.c	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/score/src/corerwlockobtainread.c	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -85,4 +85,5 @@
       _ISR_Enable( level );
       executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
+      return;
     }
 
Index: cpukit/score/src/corerwlockobtainwrite.c
===================================================================
--- cpukit/score/src/corerwlockobtainwrite.c	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/score/src/corerwlockobtainwrite.c	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -75,4 +75,5 @@
       _ISR_Enable( level );
       executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
+      return;
     }
 
Index: cpukit/score/src/corerwlockrelease.c
===================================================================
--- cpukit/score/src/corerwlockrelease.c	(revision 5700b804e2443135a07c6ff5f65a024e7be412fd)
+++ cpukit/score/src/corerwlockrelease.c	(revision 1d56a7a8b8a0b48fdeb02f6d4408a8236e8ccf95)
@@ -41,5 +41,4 @@
   Thread_Control *executing = _Thread_Executing;
   Thread_Control *next;
-  uint32_t        rwmode;
 
   /*
@@ -81,30 +80,28 @@
     
     if ( next ) {
-      rwmode = next->Wait.option;
-      if ( rwmode == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) {
-       the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
-       return CORE_RWLOCK_SUCCESSFUL;
-     } 
+      if ( next->Wait.option == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) {
+        the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
+        return CORE_RWLOCK_SUCCESSFUL;
+      }
 
-     /*
-      * Must be CORE_RWLOCK_THREAD_WAITING_FOR_READING now see if more
-      * readers can be let go.
-      */
+      /*
+       * Must be CORE_RWLOCK_THREAD_WAITING_FOR_READING
+       */
+      the_rwlock->number_of_readers += 1;
+      the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_READING;
 
-     while ( 1 ) {
-       next = _Thread_queue_First( &the_rwlock->Wait_queue );
-       if ( !next ) 
-         return CORE_RWLOCK_SUCCESSFUL;
-       if ( next->Wait.option != CORE_RWLOCK_THREAD_WAITING_FOR_READ )
-         return CORE_RWLOCK_SUCCESSFUL;
-
-       /* it is definitely wanting to read */
-       the_rwlock->number_of_readers += 1;
-       _Thread_queue_Extract( &the_rwlock->Wait_queue, next );
-     }
-
-    /* XXX need to put read/write lock request indicator in Wait info */
-
-  }
+      /*
+       * Now see if more readers can be let go.
+       */
+      while ( 1 ) {
+        next = _Thread_queue_First( &the_rwlock->Wait_queue );
+        if ( !next ||  
+             next->Wait.option == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE )
+          return CORE_RWLOCK_SUCCESSFUL;
+        the_rwlock->number_of_readers += 1;
+        _Thread_queue_Extract( &the_rwlock->Wait_queue, next );
+      }
+    }
+  /* indentation is to match _ISR_Disable at top */
 
   return CORE_RWLOCK_SUCCESSFUL;
