From: mquinson Date: Tue, 7 Dec 2010 15:56:51 +0000 (+0000) Subject: Use a raw array instead of a dynar to store the requests X-Git-Tag: v3.6_beta2~846 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b594a866f10f658d725664edb02ab7c0994ae805?hp=5d4d30871b78accac640109573494a78237badce Use a raw array instead of a dynar to store the requests It can be made big enough at every point, so that we don't have to expend it on need automatically from the dynar stuff. This was the only remaining reason why we had to lock that structure, so kill the locking stuff too. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9077 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 3d6bbf0659..889543f810 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -5,30 +5,24 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_smurf, simix, "Logging specific to SIMIX (SMURF)"); -static xbt_dynar_t req_vector; -static xbt_os_mutex_t sync_req_vector; +static smx_req_t* req_vector=NULL; void SIMIX_request_init(void) { - sync_req_vector = xbt_os_mutex_init(); - req_vector = xbt_dynar_new(sizeof(void *), NULL); + req_vector = xbt_new0(smx_req_t,1);/* enough room for maestro's requests */ } void SIMIX_request_destroy(void) { - xbt_os_mutex_destroy(sync_req_vector); - xbt_dynar_free(&req_vector); + free(req_vector); + req_vector = NULL; } void SIMIX_request_push(smx_req_t req) { req->issuer = SIMIX_process_self(); if (req->issuer != simix_global->maestro_process){ - if (_surf_parallel_contexts) - xbt_os_mutex_acquire(sync_req_vector); - xbt_dynar_set_as(req_vector, req->issuer->pid, smx_req_t, req); - if (_surf_parallel_contexts) - xbt_os_mutex_release(sync_req_vector); + req_vector[req->issuer->pid] = req; req->issuer->request = req; DEBUG2("Yield process '%s' on request of type %d", req->issuer->name, req->call); SIMIX_process_yield(); @@ -40,11 +34,13 @@ void SIMIX_request_push(smx_req_t req) smx_req_t SIMIX_request_pop(void) { smx_req_t request = NULL; - while (xbt_dynar_length(req_vector)){ - request = xbt_dynar_pop_as(req_vector, smx_req_t); - if (request) + int i; + for (i=1;iprocess_create.result = SIMIX_process_create( req->process_create.name, req->process_create.code,