This change fixes the error handling circuitry in the initialization routine
for suspension objects so that Storage_Error is propagated as intended if
the allocation of the underlying OS entities fails.
No test (requires system resource allocation failure).
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-10-13 Thomas Quinot <[email protected]>
* s-taprop-posix.adb (Initialize): Always raise Storage_Error
if we fail to initialize CV attributes or CV.
Index: s-taprop-posix.adb
===================================================================
--- s-taprop-posix.adb (revision 179894)
+++ s-taprop-posix.adb (working copy)
@@ -1089,9 +1089,7 @@
Result := pthread_mutex_destroy (S.L'Access);
pragma Assert (Result = 0);
- if Result = ENOMEM then
- raise Storage_Error;
- end if;
+ raise Storage_Error;
end if;
Result := pthread_cond_init (S.CV'Access, Cond_Attr'Access);
@@ -1101,11 +1099,10 @@
Result := pthread_mutex_destroy (S.L'Access);
pragma Assert (Result = 0);
- if Result = ENOMEM then
- Result := pthread_condattr_destroy (Cond_Attr'Access);
- pragma Assert (Result = 0);
- raise Storage_Error;
- end if;
+ Result := pthread_condattr_destroy (Cond_Attr'Access);
+ pragma Assert (Result = 0);
+
+ raise Storage_Error;
end if;
Result := pthread_condattr_destroy (Cond_Attr'Access);