Explorar el Código

BProcess: port to DebugError

ambrop7 hace 15 años
padre
commit
12fe99ea8d
Se han modificado 2 ficheros con 5 adiciones y 20 borrados
  1. 3 16
      system/BProcess.c
  2. 2 4
      system/BProcess.h

+ 3 - 16
system/BProcess.c

@@ -40,16 +40,7 @@
 
 static void call_handler (BProcess *o, int normally, uint8_t normally_exit_status)
 {
-    #ifndef NDEBUG
-    DEAD_ENTER(o->d_dead)
-    #endif
-    
-    o->handler(o->user, normally, normally_exit_status);
-    
-    #ifndef NDEBUG
-    ASSERT(DEAD_KILLED)
-    DEAD_LEAVE(o->d_dead);
-    #endif
+    DEBUGERROR(&o->d_err, o->handler(o->user, normally, normally_exit_status))
 }
 
 static BProcess * find_process (BProcessManager *o, pid_t pid)
@@ -240,9 +231,7 @@ int BProcess_Init (BProcess *o, BProcessManager *m, BProcess_handler handler, vo
     LinkedList2_Append(&o->m->processes, &o->list_node);
     
     DebugObject_Init(&o->d_obj);
-    #ifndef NDEBUG
-    DEAD_INIT(o->d_dead);
-    #endif
+    DebugError_Init(&o->d_err);
     
     return 1;
     
@@ -252,10 +241,8 @@ fail0:
 
 void BProcess_Free (BProcess *o)
 {
+    DebugError_Free(&o->d_err);
     DebugObject_Free(&o->d_obj);
-    #ifndef NDEBUG
-    DEAD_KILL(o->d_dead);
-    #endif
     
     // remove from processes list
     LinkedList2_Remove(&o->m->processes, &o->list_node);

+ 2 - 4
system/BProcess.h

@@ -27,7 +27,7 @@
 #include <unistd.h>
 
 #include <misc/debug.h>
-#include <misc/dead.h>
+#include <misc/debugerror.h>
 #include <structure/LinkedList2.h>
 #include <system/DebugObject.h>
 #include <system/BUnixSignal.h>
@@ -50,9 +50,7 @@ typedef struct {
     pid_t pid;
     LinkedList2Node list_node; // node in BProcessManager.processes
     DebugObject d_obj;
-    #ifndef NDEBUG
-    dead_t d_dead;
-    #endif
+    DebugError d_err;
 } BProcess;
 
 int BProcessManager_Init (BProcessManager *o, BReactor *reactor) WARN_UNUSED;