Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ansi C declaration of the variables (at the beginning of the blocks)
[simgrid.git] / src / xbt / xbt_sg_stubs.c
1 /* $Id$ */
2
3 /* xbt_sg_stubs -- empty functions sometimes used in SG (never in RL)       */
4
5 /* This is always part of SG, never of RL. Content:                         */
6 /*  - a bunch of stub functions of the thread related function that we need */
7 /*    to add to the lib to please the linker when using ucontextes.         */
8 /*  - a bunch of stub functions of the java related function when we don't  */
9 /*    compile java bindings.                                                */
10
11 /* In RL, java is useless, and threads are always part of the picture,      */
12 /*  ucontext never */
13   
14 /* Copyright (c) 2007 Martin Quinson.                                       */
15 /* All rights reserved.                                                     */
16
17 /* This program is free software; you can redistribute it and/or modify it
18  * under the terms of the license (GNU LGPL) which comes with this package. */
19
20 #include "xbt_modinter.h"
21 #include "xbt/sysdep.h"
22 #include "xbt/xbt_os_thread.h"
23 #include "portable.h" /* CONTEXT_THREADS */
24
25 #ifndef CONTEXT_THREADS
26
27 /* xbt_threads is loaded in libsimgrid when they are used to implement the xbt_context.
28  * The decision (and the loading) is made in xbt/context.c.
29  */
30
31 /* Mod_init/exit mecanism */
32 void xbt_os_thread_mod_init(void) {}
33    
34 void xbt_os_thread_mod_exit(void) {}
35
36
37 /* Main functions */
38
39 xbt_os_thread_t xbt_os_thread_create(const char*name,pvoid_f_pvoid_t start_routine,void* param) {
40    xbt_backtrace_display_current();
41    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
42 }
43
44 void xbt_os_thread_exit(int *retcode){
45    xbt_backtrace_display_current();
46    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
47 }
48
49 xbt_os_thread_t xbt_os_thread_self(void){
50    xbt_backtrace_display_current();
51    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_self)");
52 }
53
54 void xbt_os_thread_yield(void){
55    xbt_backtrace_display_current();
56    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_yield)");
57 }
58
59
60 xbt_os_mutex_t xbt_os_mutex_init(void){
61    xbt_backtrace_display_current();
62    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_init)");
63 }
64
65 void xbt_os_mutex_acquire(xbt_os_mutex_t mutex){
66    xbt_backtrace_display_current();
67    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_acquire)");
68 }
69
70 void xbt_os_mutex_release(xbt_os_mutex_t mutex){
71    xbt_backtrace_display_current();
72    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_release)");
73 }
74
75 void xbt_os_mutex_destroy(xbt_os_mutex_t mutex){
76    xbt_backtrace_display_current();
77    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_destroy)");
78 }
79
80 xbt_os_cond_t xbt_os_cond_init(void){
81    xbt_backtrace_display_current();
82    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_init)");
83 }
84
85 void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex){
86    xbt_backtrace_display_current();
87    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_wait)");
88 }
89
90 void xbt_os_cond_signal(xbt_os_cond_t cond){
91    xbt_backtrace_display_current();
92    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_signal)");
93 }
94
95 void xbt_os_cond_broadcast(xbt_os_cond_t cond){
96    xbt_backtrace_display_current();
97    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_broadcast)");
98 }
99
100 void xbt_os_cond_destroy(xbt_os_cond_t cond){
101    xbt_backtrace_display_current();
102    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
103 }
104 #endif
105
106
107 #ifndef HAVE_JAVA
108 #include "xbt/xbt_context_private.h"
109 int xbt_jcontext_factory_init(xbt_context_factory_t* factory) {
110    return -1;
111 }
112 #endif