X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/eb547ff91feeac5a0e9e258872cc648d6d947aa2..43f5aa483faaf237121a30a49e59ce74e42e1acc:/src/xbt/xbt_sg_synchro.c diff --git a/src/xbt/xbt_sg_synchro.c b/src/xbt/xbt_sg_synchro.c index e04f5a14f3..b086b9a51a 100644 --- a/src/xbt/xbt_sg_synchro.c +++ b/src/xbt/xbt_sg_synchro.c @@ -62,7 +62,7 @@ xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code, res->code = code; res->father_data = SIMIX_process_self_get_data(SIMIX_process_self()); /* char*name = bprintf("%s#%p",SIMIX_process_self_get_name(), param); */ - simcall_process_create(&res->s_process, name, + res->s_process = simcall_process_create(name, xbt_thread_create_wrapper, res, SIMIX_host_self_get_name(), -1.0, 0, NULL, /*props */ NULL,0); @@ -140,6 +140,11 @@ void xbt_mutex_acquire(xbt_mutex_t mutex) simcall_mutex_lock((smx_mutex_t) mutex); } +int xbt_mutex_try_acquire(xbt_mutex_t mutex) +{ + return simcall_mutex_trylock((smx_mutex_t) mutex); +} + void xbt_mutex_release(xbt_mutex_t mutex) { simcall_mutex_unlock((smx_mutex_t) mutex); @@ -204,16 +209,21 @@ xbt_bar_t xbt_barrier_init(unsigned int count) } -void xbt_barrier_wait(xbt_bar_t bar) +int xbt_barrier_wait(xbt_bar_t bar) { + int ret=0; xbt_mutex_acquire(bar->mutex); if (++bar->arrived_processes == bar->expected_processes) { xbt_cond_broadcast(bar->cond); xbt_mutex_release(bar->mutex); + ret=XBT_BARRIER_SERIAL_PROCESS; + bar->arrived_processes = 0; } else { xbt_cond_wait(bar->cond, bar->mutex); xbt_mutex_release(bar->mutex); } + + return ret; } void xbt_barrier_destroy(xbt_bar_t bar)