Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixed licence and copyright. No more reference to da GRAS possee or the
[simgrid.git] / src / gras / Virtu / process.c
1 /* $Id$ */
2
3 /* process - GRAS process handling (common code for RL and SG)              */
4
5 /* Copyright (c) 2004 Martin Quinson. All rights reserved.                  */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "xbt/sysdep.h"
11 #include "xbt/log.h"
12 #include "xbt/error.h"
13 #include "gras/transport.h"
14 #include "gras/datadesc.h"
15 #include "gras/messages.h"
16
17 #include "gras/Virtu/virtu_interface.h"
18 #include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */
19
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(process,gras,"Process manipulation code");
21
22 /* **************************************************************************
23  * Process data
24  * **************************************************************************/
25 void *gras_userdata_get(void) {
26   gras_procdata_t *pd=gras_procdata_get();
27   return pd->userdata;
28 }
29
30 void gras_userdata_set(void *ud) {
31   gras_procdata_t *pd=gras_procdata_get();
32
33   pd->userdata = ud;
34 }
35
36 void
37 gras_procdata_init() {
38   gras_procdata_t *pd=gras_procdata_get();
39   pd->userdata  = NULL;
40   pd->msg_queue = xbt_dynar_new(sizeof(gras_msg_t),     NULL);
41   pd->cbl_list  = xbt_dynar_new(sizeof(gras_cblist_t *),gras_cbl_free);
42   pd->sockets   = xbt_dynar_new(sizeof(gras_socket_t*), NULL);
43 }
44
45 void
46 gras_procdata_exit() {
47   gras_procdata_t *pd=gras_procdata_get();
48
49   xbt_dynar_free(&( pd->msg_queue ));
50   xbt_dynar_free(&( pd->cbl_list ));
51   xbt_dynar_free(&( pd->sockets ));
52 }
53
54 xbt_dynar_t 
55 gras_socketset_get(void) {
56    return gras_procdata_get()->sockets;
57 }