Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
now this file doesn't use the native locks
[simgrid.git] / src / java / jxbt_context.h
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Arnaud Legrand, Martin Quinson, Malek Cherier         
5  * All right reserved. 
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. 
9  */
10
11 #ifndef XBT_JCONTEXT_H
12 #define XBT_JCONTEXT_H
13
14
15 #include "xbt/sysdep.h"
16 #include "xbt/swag.h"
17 #include "xbt/dynar.h" /* void_f_pvoid_t */
18 #include "portable.h"  /* loads context system definitions */
19 #include "xbt/context.h"
20 #include "xbt/ex.h"
21 #include "xbt/xbt_os_thread.h"
22 #include <jni.h>
23
24 SG_BEGIN_DECL()
25
26
27 /* pointers to schedule and unschedule functions */
28 typedef void (*pfn_schedule_t)(xbt_context_t);
29 typedef pfn_schedule_t pfn_unschedule_t;
30
31 /**
32  * This function gets the context of a java process instance.
33  * 
34  * @param index         The id (index in the table) of the java process object.
35  *
36  * @return                      The context of the java process object.
37  */
38 xbt_context_t xbt_context_get_by_id(jlong index);
39
40 /*
41  * This function appends a context in the table of contexts of the simulation.
42  *
43  * @param context       The context to append.
44  *
45  * @return      Returns 0 if successful the function returns 0, and -1 otherwise.
46  */
47 int xbt_context_append(xbt_context_t context);
48
49 /*
50  * This function is called by the simulator to terminate a java process instance.
51  *
52  * @param context       The context of the java process to terminate.
53  * @param value         not used.
54  */
55 void __context_exit(xbt_context_t context ,int value);
56
57 /*
58  * This function is called by the java process to indicate it's done
59  * 
60  * @param context       The context of the process concerning by the ending.
61  * @parma value         not used.
62  * @param env           The jni interface pointer of the process.
63  */
64 void jcontext_exit(xbt_context_t context ,int value,JNIEnv* env);
65
66 /** Returns the condition used to synchronise the creation of a java process. */
67 xbt_os_cond_t xbt_creation_cond_get(void);
68
69 /** Returns the mutex used to synchronise the creation of a java process */
70 xbt_os_mutex_t xbt_creation_mutex_get(void);
71
72 SG_END_DECL()
73
74 #endif  /* !_XBT_CONTEXT_PRIVATE_H */