Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[LUA] Fixed compile time warnings, 2/2
[simgrid.git] / src / bindings / java / JavaContext.hpp
index fbad882..dfbf821 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef SIMGRID_JAVA_JAVA_CONTEXT_HPP
 #define SIMGRID_JAVA_JAVA_CONTEXT_HPP
 
+#include <functional>
+
 #include <jni.h>
 
 #include <xbt/misc.h>
@@ -27,18 +29,17 @@ class JavacontextFactory;
 class JavaContext : public simgrid::simix::Context {
 public:
   // The java process instance bound with the msg process structure:
-  jobject jprocess;
+  jobject jprocess = nullptr;
   // JNI interface pointer associated to this thread:
-  JNIEnv *jenv;
-  xbt_os_thread_t thread;
+  JNIEnv *jenv = nullptr;
+  xbt_os_thread_t thread = nullptr;
   // Sempahore used to schedule/yield the process:
-  xbt_os_sem_t begin;
+  xbt_os_sem_t begin = nullptr;
   // Semaphore used to schedule/unschedule the process:
-  xbt_os_sem_t end;
+  xbt_os_sem_t end = nullptr;
 public:
   friend class JavaContextFactory;
-  JavaContext(xbt_main_func_t code,
-          int argc, char **argv,
+  JavaContext(std::function<void()> code,
           void_pfn_smxprocess_t cleanup_func,
           smx_process_t process);
   ~JavaContext() override;
@@ -54,14 +55,13 @@ public:
   JavaContextFactory();
   ~JavaContextFactory() override;
   JavaContext* self() override;
-  JavaContext* create_context(
-    xbt_main_func_t, int, char **, void_pfn_smxprocess_t,
-    smx_process_t process
-    ) override;
+  JavaContext* create_context(std::function<void()> code,
+    void_pfn_smxprocess_t, smx_process_t process) override;
   void run_all() override;
 };
 
 XBT_PRIVATE simgrid::simix::ContextFactory* java_factory();
+XBT_PRIVATE void java_main_jprocess(jobject process);
 
 }
 }