OSDN Git Service

2009-11-30 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-taprop-vxworks.adb
index 622e3b5..4cde338 100644 (file)
@@ -430,12 +430,10 @@ package body System.Task_Primitives.Operations is
 
       --  Release the mutex before sleeping
 
-      if Single_Lock then
-         Result := semGive (Single_RTS_Lock.Mutex);
-      else
-         Result := semGive (Self_ID.Common.LL.L.Mutex);
-      end if;
-
+      Result :=
+        semGive (if Single_Lock
+                 then Single_RTS_Lock.Mutex
+                 else Self_ID.Common.LL.L.Mutex);
       pragma Assert (Result = 0);
 
       --  Perform a blocking operation to take the CV semaphore. Note that a
@@ -448,12 +446,10 @@ package body System.Task_Primitives.Operations is
 
       --  Take the mutex back
 
-      if Single_Lock then
-         Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
-      else
-         Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER);
-      end if;
-
+      Result :=
+        semTake ((if Single_Lock
+                  then Single_RTS_Lock.Mutex
+                  else Self_ID.Common.LL.L.Mutex), WAIT_FOREVER);
       pragma Assert (Result = 0);
    end Sleep;
 
@@ -506,12 +502,10 @@ package body System.Task_Primitives.Operations is
          loop
             --  Release the mutex before sleeping
 
-            if Single_Lock then
-               Result := semGive (Single_RTS_Lock.Mutex);
-            else
-               Result := semGive (Self_ID.Common.LL.L.Mutex);
-            end if;
-
+            Result :=
+              semGive (if Single_Lock
+                       then Single_RTS_Lock.Mutex
+                       else Self_ID.Common.LL.L.Mutex);
             pragma Assert (Result = 0);
 
             --  Perform a blocking operation to take the CV semaphore. Note
@@ -551,12 +545,10 @@ package body System.Task_Primitives.Operations is
 
             --  Take the mutex back
 
-            if Single_Lock then
-               Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
-            else
-               Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER);
-            end if;
-
+            Result :=
+              semTake ((if Single_Lock
+                        then Single_RTS_Lock.Mutex
+                        else Self_ID.Common.LL.L.Mutex), WAIT_FOREVER);
             pragma Assert (Result = 0);
 
             exit when Timedout or Wakeup;
@@ -623,11 +615,10 @@ package body System.Task_Primitives.Operations is
 
          --  Modifying State, locking the TCB
 
-         if Single_Lock then
-            Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
-         else
-            Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER);
-         end if;
+         Result :=
+           semTake ((if Single_Lock
+                     then Single_RTS_Lock.Mutex
+                     else Self_ID.Common.LL.L.Mutex), WAIT_FOREVER);
 
          pragma Assert (Result = 0);
 
@@ -639,11 +630,10 @@ package body System.Task_Primitives.Operations is
 
             --  Release the TCB before sleeping
 
-            if Single_Lock then
-               Result := semGive (Single_RTS_Lock.Mutex);
-            else
-               Result := semGive (Self_ID.Common.LL.L.Mutex);
-            end if;
+            Result :=
+              semGive (if Single_Lock
+                       then Single_RTS_Lock.Mutex
+                       else Self_ID.Common.LL.L.Mutex);
             pragma Assert (Result = 0);
 
             exit when Aborted;
@@ -670,11 +660,11 @@ package body System.Task_Primitives.Operations is
             --  Take back the lock after having slept, to protect further
             --  access to Self_ID.
 
-            if Single_Lock then
-               Result := semTake (Single_RTS_Lock.Mutex, WAIT_FOREVER);
-            else
-               Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER);
-            end if;
+            Result :=
+              semTake
+                ((if Single_Lock
+                  then Single_RTS_Lock.Mutex
+                  else Self_ID.Common.LL.L.Mutex), WAIT_FOREVER);
 
             pragma Assert (Result = 0);
 
@@ -683,11 +673,11 @@ package body System.Task_Primitives.Operations is
 
          Self_ID.Common.State := Runnable;
 
-         if Single_Lock then
-            Result := semGive (Single_RTS_Lock.Mutex);
-         else
-            Result := semGive (Self_ID.Common.LL.L.Mutex);
-         end if;
+         Result :=
+           semGive
+             (if Single_Lock
+              then Single_RTS_Lock.Mutex
+              else Self_ID.Common.LL.L.Mutex);
 
       else
          taskDelay (0);