Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make communications from an host to itself instantaneous
[simgrid.git] / src / gras / gras.c
1 /* $Id$ */
2
3 /* gras.c -- generic functions not fitting anywhere else                    */
4
5 /* Copyright (c) 2003, 2004 Martin Quinson.                                 */
6 /* All rights reserved.                                                     */
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/log.h"
12 #include "xbt/module.h" /* xbt_init/exit */
13
14 #include "gras_modinter.h"   /* module init/exit */
15 #include "xbt_modinter.h"   /* module init/exit */
16
17 #include "gras/core.h"
18 #include "gras/process.h" /* FIXME: killme and put process_init in modinter */
19
20 XBT_LOG_NEW_DEFAULT_CATEGORY(gras,"All GRAS categories");
21 static int gras_running_process = 0;
22
23 void gras_init(int *argc,char **argv, const char *defaultlog) {
24
25   INFO0("Initialize GRAS");
26   xbt_assert0(0,"Work in progress. Forget about GRAS for now.");
27   xbt_init_defaultlog(argc,argv,defaultlog);
28   gras_process_init(); /* calls procdata_init, which calls dynar_new */
29   /** init other submodules */
30   if (gras_running_process++ == 0) {
31     gras_msg_init();
32     gras_trp_init();
33     gras_datadesc_init();
34   }
35 }
36
37 void gras_exit(void) {
38   INFO0("Exiting GRAS");
39   gras_process_exit();
40   if (--gras_running_process == 0) {
41     gras_msg_exit();
42     gras_trp_exit();
43     gras_datadesc_exit();
44   }
45   xbt_exit();
46 }