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
Let it compile without --disable-compile-optimizations
[simgrid.git]
/
src
/
java
/
jxbt_context.c
diff --git
a/src/java/jxbt_context.c
b/src/java/jxbt_context.c
index
e9cd2a3
..
ea22c83
100644
(file)
--- a/
src/java/jxbt_context.c
+++ b/
src/java/jxbt_context.c
@@
-11,7
+11,8
@@
#include "portable.h"
#include "xbt/log.h"
#include "xbt/dynar.h"
#include "portable.h"
#include "xbt/log.h"
#include "xbt/dynar.h"
-#include "xbt/xbt_thread.h"
+#include "xbt/xbt_os_thread.h"
+#include "xbt/ex_interface.h"
#include "java/jxbt_context.h"
#include "java/jmsg.h"
#include "java/jmsg_process.h"
#include "java/jxbt_context.h"
#include "java/jmsg.h"
#include "java/jmsg_process.h"
@@
-27,10
+28,10
@@
static xbt_context_t current_context = NULL; /* the current context */
static xbt_context_t init_context = NULL; /* the initial context */
static xbt_swag_t context_to_destroy = NULL; /* the list of the contexs to destroy */
static xbt_swag_t context_living = NULL; /* the list of the contexts in use */
static xbt_context_t init_context = NULL; /* the initial context */
static xbt_swag_t context_to_destroy = NULL; /* the list of the contexs to destroy */
static xbt_swag_t context_living = NULL; /* the list of the contexts in use */
-static xbt_mutex_t creation_mutex; /* For syncronization during process creation */
-static xbt_
th
cond_t creation_cond; /* For syncronization during process creation */
-static xbt_
mutex_t master_mutex;
/* For syncronization during process scheduling*/
-static xbt_
thcond_t master_cond;
/* For syncronization during process scheduling*/
+static xbt_
os_
mutex_t creation_mutex; /* For syncronization during process creation */
+static xbt_
os_
cond_t creation_cond; /* For syncronization during process creation */
+static xbt_
os_mutex_t master_mutex;
/* For syncronization during process scheduling*/
+static xbt_
os_cond_t master_cond;
/* For syncronization during process scheduling*/
static void
__xbt_context_yield(xbt_context_t context);
static void
__xbt_context_yield(xbt_context_t context);
@@
-50,15
+51,15
@@
__xbt_context_yield(xbt_context_t context) {
* - restore thr current contex
*/
* - restore thr current contex
*/
- xbt_mutex_lock(master_mutex);
- xbt_mutex_lock(context->mutex);
+ xbt_
os_
mutex_lock(master_mutex);
+ xbt_
os_
mutex_lock(context->mutex);
/* update the current context */
current_context = context;
/* update the current context */
current_context = context;
- xbt_
th
cond_signal(context->cond);
- xbt_mutex_unlock(context->mutex);
- xbt_
th
cond_wait(master_cond, master_mutex);
- xbt_mutex_unlock(master_mutex);
+ xbt_
os_
cond_signal(context->cond);
+ xbt_
os_
mutex_unlock(context->mutex);
+ xbt_
os_
cond_wait(master_cond, master_mutex);
+ xbt_
os_
mutex_unlock(master_mutex);
/* retore the current context */
current_context = self;
/* retore the current context */
current_context = self;
@@
-70,14
+71,14
@@
__xbt_context_yield(xbt_context_t context) {
* - restore thr current contex
*/
* - restore thr current contex
*/
- xbt_mutex_lock(master_mutex);
- xbt_mutex_lock(context->mutex);
+ xbt_
os_
mutex_lock(master_mutex);
+ xbt_
os_
mutex_lock(context->mutex);
/* update the current context */
current_context = context;
/* update the current context */
current_context = context;
- xbt_
th
cond_signal(master_cond);
- xbt_mutex_unlock(master_mutex);
- xbt_
th
cond_wait(context->cond, context->mutex);
- xbt_mutex_unlock(context->mutex);
+ xbt_
os_
cond_signal(master_cond);
+ xbt_
os_
mutex_unlock(master_mutex);
+ xbt_
os_
cond_wait(context->cond, context->mutex);
+ xbt_
os_
mutex_unlock(context->mutex);
/* retore the current context */
current_context = self;
}
/* retore the current context */
current_context = self;
}
@@
-104,10
+105,10
@@
xbt_context_free(xbt_context_t context) {
}
/* destroy the mutex of the process */
}
/* destroy the mutex of the process */
- xbt_mutex_destroy(context->mutex);
+ xbt_
os_
mutex_destroy(context->mutex);
/* destroy the condition of the process */
/* destroy the condition of the process */
- xbt_
th
cond_destroy(context->cond);
+ xbt_
os_
cond_destroy(context->cond);
context->mutex = NULL;
context->cond = NULL;
context->mutex = NULL;
context->cond = NULL;
@@
-137,10
+138,10
@@
__context_exit(xbt_context_t context ,int value) {
/*
* signal the condition of the java process
*/
/*
* signal the condition of the java process
*/
- xbt_mutex_lock(master_mutex);
- xbt_mutex_lock(context->mutex);
- xbt_
th
cond_signal(context->cond);
- xbt_mutex_unlock(context->mutex);
+ xbt_
os_
mutex_lock(master_mutex);
+ xbt_
os_
mutex_lock(context->mutex);
+ xbt_
os_
cond_signal(context->cond);
+ xbt_
os_
mutex_unlock(context->mutex);
if (context->jprocess) {
/* if the java process is alive, stop it */
if (context->jprocess) {
/* if the java process is alive, stop it */
@@
-172,10
+173,10
@@
jcontext_exit(xbt_context_t context ,int value,JNIEnv* env) {
/*
* signal the condition of the main thread.
*/
/*
* signal the condition of the main thread.
*/
- xbt_mutex_lock(master_mutex);
- xbt_mutex_lock(context->mutex);
- xbt_
th
cond_signal(master_cond);
- xbt_mutex_unlock(master_mutex);
+ xbt_
os_
mutex_lock(master_mutex);
+ xbt_
os_
mutex_lock(context->mutex);
+ xbt_
os_
cond_signal(master_cond);
+ xbt_
os_
mutex_unlock(master_mutex);
/* the global reference to the java process instance is deleted */
/* the global reference to the java process instance is deleted */
@@
-224,14
+225,14
@@
xbt_context_init(void) {
xbt_swag_insert(init_context, context_living);
/* this mutex is used to synchronize the creation of the java process */
xbt_swag_insert(init_context, context_living);
/* this mutex is used to synchronize the creation of the java process */
- creation_mutex = xbt_mutex_init();
+ creation_mutex = xbt_
os_
mutex_init();
/* this mutex is used to synchronize the creation of the java process */
/* this mutex is used to synchronize the creation of the java process */
- creation_cond = xbt_
th
cond_init();
+ creation_cond = xbt_
os_
cond_init();
/* this mutex is used to synchronize the scheduling of the java process */
/* this mutex is used to synchronize the scheduling of the java process */
- master_mutex = xbt_mutex_init();
+ master_mutex = xbt_
os_
mutex_init();
/* this mutex is used to synchronize the scheduling of the java process */
/* this mutex is used to synchronize the scheduling of the java process */
- master_cond = xbt_
th
cond_init();
+ master_cond = xbt_
os_
cond_init();
}
}
}
}
@@
-254,23
+255,23
@@
xbt_context_start(xbt_context_t context) {
context, context->jprocess, context->jenv);
/* the main thread locks the mutex used to create all the process */
context, context->jprocess, context->jenv);
/* the main thread locks the mutex used to create all the process */
- xbt_mutex_lock(creation_mutex);
+ xbt_
os_
mutex_lock(creation_mutex);
/* the main thread starts the java process */
jprocess_start(context->jprocess,context->jenv);
/* the main thread waits the startup of the java process */
/* the main thread starts the java process */
jprocess_start(context->jprocess,context->jenv);
/* the main thread waits the startup of the java process */
- xbt_
th
cond_wait(creation_cond, creation_mutex);
+ xbt_
os_
cond_wait(creation_cond, creation_mutex);
/* the java process is started, the main thread unlocks the mutex
* used during the creation of the java process
*/
/* the java process is started, the main thread unlocks the mutex
* used during the creation of the java process
*/
- xbt_mutex_unlock(creation_mutex);
+ xbt_
os_
mutex_unlock(creation_mutex);
}
xbt_context_t
}
xbt_context_t
-xbt_context_new(xbt_
context_function
_t code,
+xbt_context_new(xbt_
main_func
_t code,
void_f_pvoid_t startup_func, void *startup_arg,
void_f_pvoid_t cleanup_func, void *cleanup_arg,
int argc, char *argv[]) {
void_f_pvoid_t startup_func, void *startup_arg,
void_f_pvoid_t cleanup_func, void *cleanup_arg,
int argc, char *argv[]) {
@@
-278,8
+279,8
@@
xbt_context_new(xbt_context_function_t code,
context->code = code;
context->code = code;
- context->mutex = xbt_mutex_init();
- context->cond = xbt_
th
cond_init();
+ context->mutex = xbt_
os_
mutex_init();
+ context->cond = xbt_
os_
cond_init();
context->argc = argc;
context->argc = argc;
@@
-338,10
+339,10
@@
void xbt_context_exit(void) {
xbt_swag_free(context_to_destroy);
xbt_swag_free(context_living);
xbt_swag_free(context_to_destroy);
xbt_swag_free(context_living);
- xbt_mutex_destroy(creation_mutex);
- xbt_
th
cond_destroy(creation_cond);
- xbt_mutex_destroy(master_mutex);
- xbt_
th
cond_destroy(master_cond);
+ xbt_
os_
mutex_destroy(creation_mutex);
+ xbt_
os_
cond_destroy(creation_cond);
+ xbt_
os_
mutex_destroy(master_mutex);
+ xbt_
os_
cond_destroy(master_cond);
}
/**
}
/**
@@
-354,12
+355,12
@@
void xbt_context_kill(xbt_context_t context) {
__xbt_context_yield(context);
}
__xbt_context_yield(context);
}
-xbt_
th
cond_t
+xbt_
os_
cond_t
xbt_creation_cond_get(void) {
return creation_cond;
}
xbt_creation_cond_get(void) {
return creation_cond;
}
-xbt_mutex_t
+xbt_
os_
mutex_t
xbt_creation_mutex_get(void) {
return creation_mutex;
}
xbt_creation_mutex_get(void) {
return creation_mutex;
}