Logo AND Algorithmique Numérique Distribuée

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