A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kill french dupplicate of the log documentation now that the doxygen one is in place
[simgrid.git]
/
src
/
xbt
/
context.c
diff --git
a/src/xbt/context.c
b/src/xbt/context.c
index
4f57bc7
..
5ab348d
100644
(file)
--- a/
src/xbt/context.c
+++ b/
src/xbt/context.c
@@
-25,7
+25,7
@@
static xbt_swag_t context_to_destroy = NULL;
static xbt_swag_t context_living = NULL;
#ifndef USE_PTHREADS /* USE_PTHREADS and USE_CONTEXT are exclusive */
static xbt_swag_t context_living = NULL;
#ifndef USE_PTHREADS /* USE_PTHREADS and USE_CONTEXT are exclusive */
-# ifndef
HAVE_UCONTEXT_H
+# ifndef
USE_UCONTEXT
/* don't want to play with conditional compilation in automake tonight, sorry.
include directly the c file from here when needed. */
# include "context_win32.c"
/* don't want to play with conditional compilation in automake tonight, sorry.
include directly the c file from here when needed. */
# include "context_win32.c"
@@
-44,11
+44,17
@@
static void __xbt_context_yield(xbt_context_t context)
#ifdef USE_PTHREADS
if (context) {
xbt_context_t self = current_context;
#ifdef USE_PTHREADS
if (context) {
xbt_context_t self = current_context;
+ DEBUG0("**** Locking ****");
pthread_mutex_lock(&(context->mutex));
pthread_mutex_lock(&(context->mutex));
+ DEBUG0("**** Updating current_context ****");
current_context = context;
current_context = context;
+ DEBUG0("**** Releasing the prisonner ****");
pthread_cond_signal(&(context->cond));
pthread_cond_signal(&(context->cond));
+ DEBUG0("**** Going to jail ****");
pthread_cond_wait(&(context->cond), &(context->mutex));
pthread_cond_wait(&(context->cond), &(context->mutex));
+ DEBUG0("**** Unlocking ****");
pthread_mutex_unlock(&(context->mutex));
pthread_mutex_unlock(&(context->mutex));
+ DEBUG0("**** Updating current_context ****");
current_context = self;
}
#else
current_context = self;
}
#else
@@
-102,7
+108,13
@@
static void *__context_wrapper(void *c)
int i;
#ifdef USE_PTHREADS
int i;
#ifdef USE_PTHREADS
+ DEBUG0("**** Lock ****");
+ pthread_mutex_lock(&(context->mutex));
+ DEBUG0("**** Releasing the prisonner ****");
+ pthread_cond_signal(&(context->cond));
+ DEBUG0("**** Going to Jail ****");
pthread_cond_wait(&(context->cond), &(context->mutex));
pthread_cond_wait(&(context->cond), &(context->mutex));
+ DEBUG0("**** Unlocking ****");
pthread_mutex_unlock(&(context->mutex));
#endif
pthread_mutex_unlock(&(context->mutex));
#endif
@@
-130,7
+142,7
@@
static void *__context_wrapper(void *c)
/** \name Functions
* \ingroup XBT_context
*/
/** \name Functions
* \ingroup XBT_context
*/
-/*
@{
*/
+/*
@{
*/
/** Context module initialization
*
* \warning It has to be called before using any other function of this module.
/** Context module initialization
*
* \warning It has to be called before using any other function of this module.
@@
-167,11
+179,16
@@
void xbt_context_empty_trash(void)
void xbt_context_start(xbt_context_t context)
{
#ifdef USE_PTHREADS
void xbt_context_start(xbt_context_t context)
{
#ifdef USE_PTHREADS
- pthread_mutex_lock(&(context->mutex));
-
/* Launch the thread */
/* Launch the thread */
+ DEBUG0("**** Locking ****");
+ pthread_mutex_lock(&(context->mutex));
+ DEBUG0("**** Pthread create ****");
xbt_assert0(!pthread_create(context->thread, NULL, __context_wrapper, context),
"Unable to create a thread.");
xbt_assert0(!pthread_create(context->thread, NULL, __context_wrapper, context),
"Unable to create a thread.");
+ DEBUG0("**** Going to jail ****");
+ pthread_cond_wait(&(context->cond), &(context->mutex));
+ DEBUG0("**** Unlocking ****");
+ pthread_mutex_unlock(&(context->mutex));
#else
makecontext (&(context->uc), (void (*) (void)) __context_wrapper,
1, context);
#else
makecontext (&(context->uc), (void (*) (void)) __context_wrapper,
1, context);
@@
-289,5
+306,4
@@
void xbt_context_free(xbt_context_t context)
return;
}
return;
}
-
-/*@}*/
+/* @} */