Commits

Nicolás Alvarez  committed b3e6c6f

Implement boinc.finish().

  • Participants
  • Parent commits cf7b831

Comments (0)

Files changed (2)

File boincmodule.cpp

 #include "boinc_api.h"
 
 PyMethodDef BoincMethods[] = {
-    {"init", pyboinc_init, METH_VARARGS, "Initializes the BOINC runtime."},
+    {"init",   pyboinc_init, METH_VARARGS, "Initializes the BOINC runtime."},
+    {"finish", pyboinc_finish, METH_VARARGS, "Initializes the BOINC runtime."},
     {NULL, NULL, 0, NULL}
 };
 
     // XXX should throw an exception if init fails
     return PyInt_FromLong(retval);
 }
-
+PyObject* pyboinc_finish(PyObject* self, PyObject* args)
+{
+    int exit_code;
+    if (!PyArg_ParseTuple(args, "i", &exit_code)) {
+        return NULL;
+    }
+    boinc_finish(exit_code);
+    // should never even reach here
+    Py_RETURN_NONE;
+}

File boincmodule.h

 #include <Python.h>
 
 extern "C" PyObject* pyboinc_init(PyObject* self, PyObject* args);
+extern "C" PyObject* pyboinc_finish(PyObject* self, PyObject* args);
 
 extern PyMethodDef BoincMethods[];