A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[java] Catch StopRequest during VM migration.
[simgrid.git]
/
src
/
bindings
/
java
/
JavaContext.hpp
diff --git
a/src/bindings/java/JavaContext.hpp
b/src/bindings/java/JavaContext.hpp
index
7af0b5e
..
f1e0570
100644
(file)
--- a/
src/bindings/java/JavaContext.hpp
+++ b/
src/bindings/java/JavaContext.hpp
@@
-1,6
+1,6
@@
/* Context switching within the JVM. */
/* Context switching within the JVM. */
-/* Copyright (c) 2009-201
7
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-201
9
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-12,8
+12,8
@@
#include <jni.h>
#include "simgrid/simix.h"
#include <jni.h>
#include "simgrid/simix.h"
+#include "src/kernel/context/ContextThread.hpp"
#include "src/simix/smx_private.hpp"
#include "src/simix/smx_private.hpp"
-#include "xbt/xbt_os_thread.h"
#include "jmsg.hpp"
#include "jmsg.hpp"
@@
-24,35
+24,26
@@
namespace context {
class JavaContext;
class JavacontextFactory;
class JavaContext;
class JavacontextFactory;
-class JavaContext : public simgrid::kernel::context::Context {
+class JavaContext : public simgrid::kernel::context::
SerialThread
Context {
public:
// The java process instance bound with the msg process structure:
public:
// The java process instance bound with the msg process structure:
- jobject jprocess = nullptr;
+ jobject jprocess
_
= nullptr;
// JNI interface pointer associated to this thread:
// JNI interface pointer associated to this thread:
- JNIEnv *jenv = nullptr;
- xbt_os_thread_t thread = nullptr;
- // Sempahore used to schedule/yield the process:
- xbt_os_sem_t begin = nullptr;
- // Semaphore used to schedule/unschedule the process:
- xbt_os_sem_t end = nullptr;
+ JNIEnv* jenv_ = nullptr;
friend class JavaContextFactory;
JavaContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
smx_actor_t process);
friend class JavaContextFactory;
JavaContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
smx_actor_t process);
- ~JavaContext() override;
- void stop() override;
- void suspend() override;
- void resume();
-private:
- static void* wrapper(void *data);
+
+ void start_hook() override;
+ void stop_hook() override;
};
class JavaContextFactory : public simgrid::kernel::context::ContextFactory {
public:
JavaContextFactory();
~JavaContextFactory() override;
};
class JavaContextFactory : public simgrid::kernel::context::ContextFactory {
public:
JavaContextFactory();
~JavaContextFactory() override;
- JavaContext* self() override;
JavaContext* create_context(std::function<void()> code,
void_pfn_smxprocess_t, smx_actor_t process) override;
void run_all() override;
JavaContext* create_context(std::function<void()> code,
void_pfn_smxprocess_t, smx_actor_t process) override;
void run_all() override;