Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add an unused (for the moment) module file
[simgrid.git] / src / xbt / xbt_sg_stubs.c
1 /* xbt_sg_stubs -- empty functions sometimes used in SG (never in RL)       */
2
3 /* This is always part of SG, never of RL. Content:                         */
4 /*  - a bunch of stub functions of the thread related function that we need */
5 /*    to add to the lib to please the linker when using ucontextes.         */
6 /*  - a bunch of stub functions of the java related function when we don't  */
7 /*    compile java bindings.                                                */
8
9 /* In RL, java is useless, and threads are always part of the picture,      */
10 /*  ucontext never */
11
12 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
13  * All rights reserved.                                                     */
14
15 /* This program is free software; you can redistribute it and/or modify it
16  * under the terms of the license (GNU LGPL) which comes with this package. */
17
18 #include "xbt_modinter.h"
19 #include "xbt/sysdep.h"
20 #include "xbt/xbt_os_thread.h"
21 #include "portable.h"           /* CONTEXT_THREADS */
22
23 #ifndef CONTEXT_THREADS
24 #ifndef WIN32
25 #ifdef HAVE_PTHREAD_H
26 /* xbt_threads is loaded in libsimgrid when they are used to implement the xbt_context.
27  * The decision (and the loading) is made in xbt/context.c.
28  */
29
30 int xbt_os_thread_atfork(void (*prepare)(void),
31                          void (*parent)(void), void (*child)(void))
32 {
33   return 0;
34 }
35
36 /* Mod_init/exit mecanism */
37 void xbt_os_thread_mod_preinit(void)
38 {
39 }
40
41 void xbt_os_thread_mod_postexit(void)
42 {
43 }
44
45
46 /* Main functions */
47
48 xbt_os_thread_t xbt_os_thread_create(const char *name,
49                                      pvoid_f_pvoid_t start_routine,
50                                      void *param, void *data)
51 {
52   xbt_backtrace_display_current();
53   xbt_die
54       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
55 }
56
57 void xbt_os_thread_exit(int *retcode)
58 {
59   xbt_backtrace_display_current();
60   xbt_die
61       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
62 }
63
64 void xbt_os_thread_detach(xbt_os_thread_t worker)
65 {
66   xbt_backtrace_display_current();
67   xbt_die
68       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
69 }
70
71 xbt_os_thread_t xbt_os_thread_self(void)
72 {
73   xbt_backtrace_display_current();
74   xbt_die
75       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_self)");
76 }
77
78 void xbt_os_thread_yield(void)
79 {
80   xbt_backtrace_display_current();
81   xbt_die
82       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_yield)");
83 }
84
85
86 xbt_os_mutex_t xbt_os_mutex_init(void)
87 {
88   /*
89      xbt_backtrace_display_current();
90      xbt_die
91      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_init)");
92    */
93   return NULL;
94 }
95
96 void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
97 {
98   /*
99      xbt_backtrace_display_current();
100      xbt_die
101      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_acquire)");
102    */
103 }
104
105 void xbt_os_mutex_release(xbt_os_mutex_t mutex)
106 {
107   /*
108      xbt_backtrace_display_current();
109      xbt_die
110      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_release)");
111    */
112 }
113
114 void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
115 {
116   /*
117      xbt_backtrace_display_current();
118      xbt_die
119      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_destroy)");
120    */
121 }
122
123 xbt_os_cond_t xbt_os_cond_init(void)
124 {
125   xbt_backtrace_display_current();
126   xbt_die
127       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_init)");
128 }
129
130 void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex)
131 {
132   xbt_backtrace_display_current();
133   xbt_die
134       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_wait)");
135 }
136
137 void xbt_os_cond_signal(xbt_os_cond_t cond)
138 {
139   xbt_backtrace_display_current();
140   xbt_die
141       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_signal)");
142 }
143
144 void xbt_os_cond_broadcast(xbt_os_cond_t cond)
145 {
146   xbt_backtrace_display_current();
147   xbt_die
148       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_broadcast)");
149 }
150
151 void xbt_os_cond_destroy(xbt_os_cond_t cond)
152 {
153   xbt_backtrace_display_current();
154   xbt_die
155       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
156 }
157 #endif
158 #endif
159 #endif