X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b1acf7fe2f1886e9adcb4313f53548c9995a906c..8c354c48ec90c997cc7213ce96ca97d882934166:/src/gras/Virtu/process.c diff --git a/src/gras/Virtu/process.c b/src/gras/Virtu/process.c index 93475bf8a6..bd22889c82 100644 --- a/src/gras/Virtu/process.c +++ b/src/gras/Virtu/process.c @@ -2,15 +2,22 @@ /* process - GRAS process handling (common code for RL and SG) */ -/* Authors: Martin Quinson */ -/* Copyright (C) 2003,2004 da GRAS posse. */ +/* Copyright (c) 2004 Martin Quinson. 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. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "gras_private.h" -#include "Virtu/virtu_interface.h" +#include "xbt/sysdep.h" +#include "xbt/log.h" +#include "xbt/error.h" +#include "gras/transport.h" +#include "gras/datadesc.h" +#include "gras/messages.h" +#include "gras/Virtu/virtu_interface.h" +#include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */ + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(process,gras,"Process manipulation code"); /* ************************************************************************** * Process data @@ -20,20 +27,31 @@ void *gras_userdata_get(void) { return pd->userdata; } -void *gras_userdata_set(void *ud) { +void gras_userdata_set(void *ud) { gras_procdata_t *pd=gras_procdata_get(); pd->userdata = ud; - - return pd->userdata; } -gras_error_t +void gras_procdata_init() { - gras_error_t errcode; gras_procdata_t *pd=gras_procdata_get(); - pd->userdata = NULL; - TRY(gras_dynar_new( &(pd->msg_queue), sizeof(gras_msg_t), NULL )); - TRY(gras_dynar_new( &(pd->cbl_list), sizeof(gras_cblist_t *), NULL )); - return no_error; + pd->userdata = NULL; + pd->msg_queue = xbt_dynar_new(sizeof(gras_msg_t), NULL); + pd->cbl_list = xbt_dynar_new(sizeof(gras_cblist_t *),gras_cbl_free); + pd->sockets = xbt_dynar_new(sizeof(gras_socket_t*), NULL); +} + +void +gras_procdata_exit() { + gras_procdata_t *pd=gras_procdata_get(); + + xbt_dynar_free(&( pd->msg_queue )); + xbt_dynar_free(&( pd->cbl_list )); + xbt_dynar_free(&( pd->sockets )); +} + +xbt_dynar_t +gras_socketset_get(void) { + return gras_procdata_get()->sockets; }