Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e06f5320aacb9295d31c632b617ce475c40b749d
[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
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 /* Mod_init/exit mecanism */
31 void xbt_os_thread_mod_preinit(void)
32 {
33 }
34
35 void xbt_os_thread_mod_postexit(void)
36 {
37 }
38
39
40 /* Main functions */
41
42 xbt_os_thread_t xbt_os_thread_create(const char *name,
43                                      pvoid_f_pvoid_t start_routine,
44                                      void *param)
45 {
46   xbt_backtrace_display_current();
47   xbt_die
48       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
49 }
50
51 void xbt_os_thread_exit(int *retcode)
52 {
53   xbt_backtrace_display_current();
54   xbt_die
55       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
56 }
57
58 xbt_os_thread_t xbt_os_thread_self(void)
59 {
60   xbt_backtrace_display_current();
61   xbt_die
62       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_self)");
63 }
64
65 void xbt_os_thread_yield(void)
66 {
67   xbt_backtrace_display_current();
68   xbt_die
69       ("No pthread in SG when compiled against the ucontext (xbt_os_thread_yield)");
70 }
71
72
73 xbt_os_mutex_t xbt_os_mutex_init(void)
74 {
75   /*
76      xbt_backtrace_display_current();
77      xbt_die
78      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_init)");
79    */
80   return NULL;
81 }
82
83 void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
84 {
85   /*
86      xbt_backtrace_display_current();
87      xbt_die
88      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_acquire)");
89    */
90 }
91
92 void xbt_os_mutex_release(xbt_os_mutex_t mutex)
93 {
94   /*
95      xbt_backtrace_display_current();
96      xbt_die
97      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_release)");
98    */
99 }
100
101 void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
102 {
103   /*
104      xbt_backtrace_display_current();
105      xbt_die
106      ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_destroy)");
107    */
108 }
109
110 xbt_os_cond_t xbt_os_cond_init(void)
111 {
112   xbt_backtrace_display_current();
113   xbt_die
114       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_init)");
115 }
116
117 void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex)
118 {
119   xbt_backtrace_display_current();
120   xbt_die
121       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_wait)");
122 }
123
124 void xbt_os_cond_signal(xbt_os_cond_t cond)
125 {
126   xbt_backtrace_display_current();
127   xbt_die
128       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_signal)");
129 }
130
131 void xbt_os_cond_broadcast(xbt_os_cond_t cond)
132 {
133   xbt_backtrace_display_current();
134   xbt_die
135       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_broadcast)");
136 }
137
138 void xbt_os_cond_destroy(xbt_os_cond_t cond)
139 {
140   xbt_backtrace_display_current();
141   xbt_die
142       ("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
143 }
144 #endif
145 #endif