Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
052d5c7dbc4233060486411c0496adfb21969376
[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 "gras/Virtu/virtu_interface.h"
13 #include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */
14
15 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(process,gras,"Process manipulation code");
16
17 /* **************************************************************************
18  * Process data
19  * **************************************************************************/
20 void *gras_userdata_get(void) {
21   gras_procdata_t *pd=gras_procdata_get();
22   return pd->userdata;
23 }
24
25 void gras_userdata_set(void *ud) {
26   gras_procdata_t *pd=gras_procdata_get();
27
28   pd->userdata = ud;
29 }
30
31 void
32 gras_procdata_init() {
33   gras_procdata_t *pd=gras_procdata_get();
34   pd->userdata = NULL;
35   gras_dynar_new(&(pd->msg_queue), sizeof(gras_msg_t),     NULL);
36   gras_dynar_new(&(pd->cbl_list),  sizeof(gras_cblist_t *),gras_cbl_free);
37   gras_dynar_new(&(pd->sockets),   sizeof(gras_socket_t*), NULL);
38 }
39
40 void
41 gras_procdata_exit() {
42   gras_procdata_t *pd=gras_procdata_get();
43
44   gras_dynar_free(pd->msg_queue);
45   gras_dynar_free(pd->cbl_list);
46   gras_dynar_free(pd->sockets);
47 }
48
49 gras_dynar_t *
50 gras_socketset_get(void) {
51    return gras_procdata_get()->sockets;
52 }