Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Take into account the case where some variable do not consume anything.
[simgrid.git] / tools / tesh / run_context.h
index 1f496d7..5704672 100644 (file)
 
 #include "tesh.h"
 
+typedef enum {e_output_check, e_output_display, e_output_ignore} e_output_handling_t;
+   
+
 typedef struct {
   /* kind of job */
   char *cmd;
+  char *filepos;
   int pid;
   int is_background:1;
   int is_empty:1;
   int is_stoppable:1;
-  int check_output:1;
   
   int brokenpipe:1;
   int timeout:1;
@@ -28,6 +31,14 @@ typedef struct {
   int reader_done:1; /* reader set this to true when he's done because
                        the child is dead. The main thread use it to detect
                        that the child is not dead before the end of timeout */
+   
+  int interrupted:1; /* Whether we got stopped by an armageddon */
+  xbt_os_mutex_t interruption; /* To allow main thread to kill a runner 
+                              one only at certain points */
+
+  e_output_handling_t output;
+   
+  int status;
 
   /* expected results */
   int end_time; /* begin_time + timeout, as epoch */
@@ -40,7 +51,8 @@ typedef struct {
   buff_t output_got;
 
   /* Threads */
-  xbt_thread_t writer, reader; /* IO handlers */
+  xbt_os_thread_t writer, reader; /* IO handlers */
+  xbt_os_thread_t runner; /* Main thread, counting for timeouts */
 
   /* Pipes from/to the child */
   int child_to, child_from;
@@ -54,6 +66,12 @@ void rctx_exit(void);
 /* wait for all currently running background jobs */
 void rctx_wait_bg(void);
 
+/* kill forcefully all currently running background jobs */
+extern rctx_t armageddon_initiator;
+extern xbt_os_mutex_t armageddon_mutex;
+void rctx_armageddon(rctx_t initiator, int exitcode);
+
+
 /* create a new empty running context */
 rctx_t rctx_new(void);
 void rctx_free(rctx_t rctx);