Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d91a9553d81bf99fe5501b6904c54a378f10f18e
[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
25 /* xbt_threads is loaded in libsimgrid when they are used to implement the xbt_context.
26  * The decision (and the loading) is made in xbt/context.c.
27  */
28
29 /* Mod_init/exit mecanism */
30 void xbt_os_thread_mod_init(void)
31 {
32 }
33
34 void xbt_os_thread_mod_exit(void)
35 {
36 }
37
38
39 /* Main functions */
40
41 xbt_os_thread_t xbt_os_thread_create(const char *name,
42                                      pvoid_f_pvoid_t start_routine,
43                                      void *param)
44 {
45   xbt_backtrace_display_current();
46   xbt_die
47     ("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
48 }
49
50 void xbt_os_thread_exit(int *retcode)
51 {
52   xbt_backtrace_display_current();
53   xbt_die
54     ("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
55 }
56
57 xbt_os_thread_t xbt_os_thread_self(void)
58 {
59   xbt_backtrace_display_current();
60   xbt_die
61     ("No pthread in SG when compiled against the ucontext (xbt_os_thread_self)");
62 }
63
64 void xbt_os_thread_yield(void)
65 {
66   xbt_backtrace_display_current();
67   xbt_die
68     ("No pthread in SG when compiled against the ucontext (xbt_os_thread_yield)");
69 }
70
71
72 xbt_os_mutex_t xbt_os_mutex_init(void)
73 {
74   xbt_backtrace_display_current();
75   xbt_die
76     ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_init)");
77 }
78
79 void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
80 {
81   xbt_backtrace_display_current();
82   xbt_die
83     ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_acquire)");
84 }
85
86 void xbt_os_mutex_release(xbt_os_mutex_t mutex)
87 {
88   xbt_backtrace_display_current();
89   xbt_die
90     ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_release)");
91 }
92
93 void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
94 {
95   xbt_backtrace_display_current();
96   xbt_die
97     ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_destroy)");
98 }
99
100 xbt_os_cond_t xbt_os_cond_init(void)
101 {
102   xbt_backtrace_display_current();
103   xbt_die
104     ("No pthread in SG when compiled against the ucontext (xbt_os_cond_init)");
105 }
106
107 void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex)
108 {
109   xbt_backtrace_display_current();
110   xbt_die
111     ("No pthread in SG when compiled against the ucontext (xbt_os_cond_wait)");
112 }
113
114 void xbt_os_cond_signal(xbt_os_cond_t cond)
115 {
116   xbt_backtrace_display_current();
117   xbt_die
118     ("No pthread in SG when compiled against the ucontext (xbt_os_cond_signal)");
119 }
120
121 void xbt_os_cond_broadcast(xbt_os_cond_t cond)
122 {
123   xbt_backtrace_display_current();
124   xbt_die
125     ("No pthread in SG when compiled against the ucontext (xbt_os_cond_broadcast)");
126 }
127
128 void xbt_os_cond_destroy(xbt_os_cond_t cond)
129 {
130   xbt_backtrace_display_current();
131   xbt_die
132     ("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
133 }
134 #endif