Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement gras_procdata_exit to plug the leaks
[simgrid.git] / src / gras / Virtu / process.c
1 /* $Id$ */
2
3 /* process - GRAS process handling (common code for RL and SG)              */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2003,2004 da GRAS posse.                                   */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #include "gras_private.h"
12 #include "Virtu/virtu_interface.h"
13
14
15 /* **************************************************************************
16  * Process data
17  * **************************************************************************/
18 void *gras_userdata_get(void) {
19   gras_procdata_t *pd=gras_procdata_get();
20   return pd->userdata;
21 }
22
23 void *gras_userdata_set(void *ud) {
24   gras_procdata_t *pd=gras_procdata_get();
25
26   pd->userdata = ud;
27
28   return pd->userdata;
29 }
30
31 gras_error_t
32 gras_procdata_init() {
33   gras_error_t errcode;
34   gras_procdata_t *pd=gras_procdata_get();
35   pd->userdata = NULL;
36   TRY(gras_dynar_new(  &(pd->msg_queue), sizeof(gras_msg_t),      NULL  ));
37   TRY(gras_dynar_new(  &(pd->cbl_list),  sizeof(gras_cblist_t *), NULL  ));
38   return no_error;
39 }
40
41 void
42 gras_procdata_exit() {
43   gras_procdata_t *pd=gras_procdata_get();
44
45   gras_dynar_free(pd->msg_queue);
46   gras_dynar_free(pd->cbl_list);
47 }
48