Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to throw an exception, and catch it just below.
[simgrid.git] / src / simix / smx_io.c
index 5720658..a19b309 100644 (file)
@@ -26,7 +26,7 @@ void SIMIX_pre_file_read(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t* stream)
+smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -68,7 +68,7 @@ void SIMIX_pre_file_write(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t* stream)
+smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -147,7 +147,7 @@ void SIMIX_pre_file_close(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t* fp)
+smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fp)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -247,7 +247,7 @@ void SIMIX_io_destroy(smx_action_t action)
 
 void SIMIX_io_finish(smx_action_t action)
 {
-  volatile xbt_fifo_item_t item;
+  xbt_fifo_item_t item;
   smx_simcall_t simcall;
 
   xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) {
@@ -259,22 +259,12 @@ void SIMIX_io_finish(smx_action_t action)
         break;
 
       case SIMIX_FAILED:
-        TRY {
-          THROWF(io_error, 0, "IO failed");
-        }
-       CATCH(simcall->issuer->running_ctx->exception) {
-         simcall->issuer->doexception = 1;
-       }
-      break;
+        SMX_EXCEPTION(simcall->issuer, io_error, 0, "IO failed");
+        break;
 
       case SIMIX_CANCELED:
-        TRY {
-          THROWF(cancel_error, 0, "Canceled");
-        }
-       CATCH(simcall->issuer->running_ctx->exception) {
-         simcall->issuer->doexception = 1;
-        }
-       break;
+        SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Canceled");
+        break;
 
       default:
         xbt_die("Internal error in SIMIX_io_finish: unexpected action state %d",