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
remove unnecessary access specifiers
[simgrid.git]
/
src
/
bindings
/
java
/
JavaContext.hpp
diff --git
a/src/bindings/java/JavaContext.hpp
b/src/bindings/java/JavaContext.hpp
index
fbad882
..
6ebaad4
100644
(file)
--- a/
src/bindings/java/JavaContext.hpp
+++ b/
src/bindings/java/JavaContext.hpp
@@
-1,5
+1,6
@@
-/* Copyright (c) 2009-2010, 2012-2014. The SimGrid Team.
- * All rights reserved. */
+/* Context switching within the JVM. */
+
+/* Copyright (c) 2009-2017. 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. */
@@
-7,40
+8,38
@@
#ifndef SIMGRID_JAVA_JAVA_CONTEXT_HPP
#define SIMGRID_JAVA_JAVA_CONTEXT_HPP
#ifndef SIMGRID_JAVA_JAVA_CONTEXT_HPP
#define SIMGRID_JAVA_JAVA_CONTEXT_HPP
+#include <functional>
#include <jni.h>
#include <jni.h>
-#include <xbt/misc.h>
-#include <simgrid/simix.h>
-#include <xbt/xbt_os_thread.h>
-
-#include "src/simix/smx_private.hpp"
+#include "simgrid/simix.h"
+#include "src/simix/smx_private.h"
+#include "xbt/xbt_os_thread.h"
#include "jmsg.h"
#include "jmsg.h"
-#include "jmsg_process.h"
namespace simgrid {
namespace simgrid {
-namespace java {
+namespace kernel {
+namespace context {
class JavaContext;
class JavacontextFactory;
class JavaContext;
class JavacontextFactory;
-class JavaContext : public simgrid::
simix
::Context {
+class JavaContext : public simgrid::
kernel::context
::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;
+ jobject jprocess
= nullptr
;
// JNI interface pointer associated to this thread:
// 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:
// 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:
// Semaphore used to schedule/unschedule the process:
- xbt_os_sem_t end;
-public:
+ xbt_os_sem_t end
= nullptr
;
+
friend class JavaContextFactory;
friend class JavaContextFactory;
- JavaContext(xbt_main_func_t code,
- int argc, char **argv,
+ JavaContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
void_pfn_smxprocess_t cleanup_func,
- smx_
process
_t process);
+ smx_
actor
_t process);
~JavaContext() override;
void stop() override;
void suspend() override;
~JavaContext() override;
void stop() override;
void suspend() override;
@@
-49,21
+48,19
@@
private:
static void* wrapper(void *data);
};
static void* wrapper(void *data);
};
-class JavaContextFactory : public simgrid::
simix
::ContextFactory {
+class JavaContextFactory : public simgrid::
kernel::context
::ContextFactory {
public:
JavaContextFactory();
~JavaContextFactory() override;
JavaContext* self() override;
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_actor_t process) override;
void run_all() override;
};
void run_all() override;
};
-XBT_PRIVATE simgrid::simix::ContextFactory* java_factory();
+XBT_PRIVATE simgrid::kernel::context::ContextFactory* java_factory();
+XBT_PRIVATE void java_main_jprocess(jobject process);
-}
-}
+}}} // namespace simgrid::kernel::context
#endif /* !_XBT_CONTEXT_JAVA_H */
#endif /* !_XBT_CONTEXT_JAVA_H */