Abstract process termination.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 22 Nov 2010 13:24:45 +0000 (13:24 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 22 Nov 2010 13:24:45 +0000 (13:24 +0000)
base.py
dl.py
glx.py
log.cpp
log.hpp
os.hpp
os_posix.cpp
os_win32.cpp

diff --git a/base.py b/base.py
index c7d18af..4afcb57 100644 (file)
--- a/base.py
+++ b/base.py
@@ -444,7 +444,7 @@ class Function:
         raise NotImplementedError
 
     def exit_impl(self):
-        print '            ExitProcess(0);'
+        print '            Log::Abort();'
 
     def fail_impl(self):
         if self.fail is not None:
diff --git a/dl.py b/dl.py
index 14b8b9f..acf328b 100644 (file)
--- a/dl.py
+++ b/dl.py
 
 """dl"""
 
+
 from base import *
 
+
 class DllFunction(Function):
 
     def __init__(self, type, name, args, call = '', fail = None):
         Function.__init__(self, type, name, args, call=call, fail=fail)
         
-    def exit_impl(self):
-        print '            exit(0);'
-
     def get_true_pointer(self):
         ptype = self.pointer_type()
         pvalue = self.pointer_value()
diff --git a/glx.py b/glx.py
index 99d07f4..79f39f2 100644 (file)
--- a/glx.py
+++ b/glx.py
@@ -477,9 +477,6 @@ class GlxFunction(Function):
     def __init__(self, type, name, args, call = '', fail = None):
         Function.__init__(self, type, name, args, call=call, fail=fail)
         
-    def exit_impl(self):
-        print '            exit(0);'
-
     def get_true_pointer(self):
         ptype = self.pointer_type()
         pvalue = self.pointer_value()
diff --git a/log.cpp b/log.cpp
index 4762db9..ea306de 100644 (file)
--- a/log.cpp
+++ b/log.cpp
@@ -281,4 +281,9 @@ void LiteralOpaque(const void *addr) {
    WriteUInt((size_t)addr);
 }
 
+void Abort(void) {
+    Close();
+    OS::Abort();
+}
+
 } /* namespace Log */
diff --git a/log.hpp b/log.hpp
index c82de5d..33fe477 100644 (file)
--- a/log.hpp
+++ b/log.hpp
@@ -69,6 +69,8 @@ namespace Log {
     void LiteralNamedConstant(const char *name, long long value);
     void LiteralNull(void);
     void LiteralOpaque(const void *ptr);
+
+    void Abort(void);
 }
 
 #endif /* _LOG_HPP_ */
diff --git a/os.hpp b/os.hpp
index 8e1c295..3c24462 100644 (file)
--- a/os.hpp
+++ b/os.hpp
@@ -47,6 +47,8 @@ void ReleaseMutex(void);
 
 bool GetProcessName(char *str, size_t size);
 
+void Abort(void);
+
 } /* namespace OS */
 
 #endif /* _OS_HPP_ */
index b13646f..a5be47d 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <string.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <pthread.h>
 
 #include "os.hpp"
@@ -76,4 +77,11 @@ GetProcessName(char *str, size_t size)
 }
 
 
+void
+Abort(void)
+{
+    exit(0);
+}
+
+
 } /* namespace OS */
index 98e397b..04c0343 100755 (executable)
@@ -78,4 +78,11 @@ GetProcessName(char *str, size_t size)
 }
 
 
+void
+Abort(void)
+{
+    ExitProcess(0);
+}
+
+
 } /* namespace OS */