X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3510c8b5311a986d920eed407f5aebd36722a7a5..7eef625065d0b3af4a64b5665009491426db974f:/src/gras/Virtu/sg_emul.c diff --git a/src/gras/Virtu/sg_emul.c b/src/gras/Virtu/sg_emul.c index 785cedea9a..b6d371ffc7 100644 --- a/src/gras/Virtu/sg_emul.c +++ b/src/gras/Virtu/sg_emul.c @@ -1,8 +1,7 @@ -/* $Id$ */ - /* sg_emul - Emulation support (simulation) */ -/* Copyright (c) 2003-5 Arnaud Legrand, Martin Quinson. All rights reserved.*/ +/* Copyright (c) 2005, 2006, 2007, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -24,22 +23,24 @@ void gras_cpu_burn(double flops) { smx_cond_t cond; smx_mutex_t mutex; - cond = SIMIX_cond_init(); - mutex = SIMIX_mutex_init(); + if (flops>0) { + cond = SIMIX_cond_init(); + mutex = SIMIX_mutex_init(); - SIMIX_mutex_lock(mutex); - act = - SIMIX_action_execute(SIMIX_host_self(), "task", flops); + SIMIX_mutex_lock(mutex); + act = + SIMIX_action_execute(SIMIX_host_self(), "task", flops); - SIMIX_register_action_to_condition(act, cond); - SIMIX_cond_wait(cond, mutex); - SIMIX_unregister_action_to_condition(act, cond); + SIMIX_register_action_to_condition(act, cond); + SIMIX_cond_wait(cond, mutex); + SIMIX_unregister_action_to_condition(act, cond); - SIMIX_action_destroy(act); - SIMIX_mutex_unlock(mutex); + SIMIX_action_destroy(act); + SIMIX_mutex_unlock(mutex); - SIMIX_cond_destroy(cond); - SIMIX_mutex_destroy(mutex); + SIMIX_cond_destroy(cond); + SIMIX_mutex_destroy(mutex); + } } /*** Timing macros ***/ static xbt_os_timer_t timer;