Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
split process.h (init/exit process; get/set userdata) out of core.h (unsorted stuff)
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 3 Mar 2004 18:32:40 +0000 (18:32 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 3 Mar 2004 18:32:40 +0000 (18:32 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@55 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/core.h
include/gras.h
include/process.h [new file with mode: 0644]
src/gras/gras_private.h

index f487dc1..acabba1 100644 (file)
@@ -42,47 +42,6 @@ BEGIN_DECL
  * **************************************************************************/
 typedef enum { free_after_use, free_never } e_gras_free_directive_t;
 
  * **************************************************************************/
 typedef enum { free_after_use, free_never } e_gras_free_directive_t;
 
-/* **************************************************************************
- * Initializing the processes
- * **************************************************************************/
-/**
- * gras_process_init:
- * 
- * Perform the various intialisations needed by gras. Each process must run it
- */
-gras_error_t gras_process_init(void);
-
-/**
- * gras_process_finalize:
- * 
- * Perform the various intialisations needed by gras. Each process must run it
- */
-gras_error_t gras_process_finalize(void);
-
-/****************************************************************************/
-/* Manipulating User Data                                                   */
-/****************************************************************************/
-/**
- * gras_userdata_get:
- *
- * Get the data associated with the current process.
- */
-void *gras_userdata_get(void);
-
-/**
- * gras_userdata_set:
- *
- * Set the data associated with the current process.
- */
-void *gras_userdata_set(void *ud);
-
-/**
- * gras_userdata_new:
- *
- * Malloc and set the data associated with the current process.
- */
-
-#define gras_userdata_new(type) gras_userdata_set(malloc(sizeof(type)))
 
 /* **************************************************************************
  * Wrappers over OS functions
 
 /* **************************************************************************
  * Wrappers over OS functions
index c72909b..39fd95d 100644 (file)
@@ -40,6 +40,8 @@
 #include <gras/config.h>
 
 #include <gras/core.h>
 #include <gras/config.h>
 
 #include <gras/core.h>
+#include <gras/process.h>
+
 
 #include <gras/transport.h>
 #include <gras/datadesc.h>
 
 #include <gras/transport.h>
 #include <gras/datadesc.h>
diff --git a/include/process.h b/include/process.h
new file mode 100644 (file)
index 0000000..76c2659
--- /dev/null
@@ -0,0 +1,85 @@
+/* $Id$                     */
+
+/* gras/core.h - Unsorted part of the GRAS public interface                 */
+
+/* Authors: Martin Quinson                                                  */
+/* Copyright (C) 2003 the OURAGAN project.                                  */
+
+/* This program is free software; you can redistribute it and/or modify it
+   under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef GRAS_PROCESS_H
+#define GRAS_PROCESS_H
+
+#include <stddef.h>    /* offsetof() */
+#include <sys/types.h>  /* size_t */
+#include <stdarg.h>
+
+
+/*! C++ users need love */
+#ifndef BEGIN_DECL
+# ifdef __cplusplus
+#  define BEGIN_DECL extern "C" {
+# else
+#  define BEGIN_DECL 
+# endif
+#endif
+
+/*! C++ users need love */
+#ifndef END_DECL
+# ifdef __cplusplus
+#  define END_DECL }
+# else
+#  define END_DECL 
+# endif
+#endif
+/* End of cruft for C++ */
+
+BEGIN_DECL
+
+/* **************************************************************************
+ * Initializing the processes
+ * **************************************************************************/
+/**
+ * gras_process_init:
+ * 
+ * Perform the various intialisations needed by gras. Each process must run it
+ */
+gras_error_t gras_process_init(void);
+
+/**
+ * gras_process_exit:
+ * 
+ * Frees the memory allocated by gras. Processes should run it
+ */
+gras_error_t gras_process_exit(void);
+
+/****************************************************************************/
+/* Manipulating User Data                                                   */
+/****************************************************************************/
+/**
+ * gras_userdata_get:
+ *
+ * Get the data associated with the current process.
+ */
+void *gras_userdata_get(void);
+
+/**
+ * gras_userdata_set:
+ *
+ * Set the data associated with the current process.
+ */
+void *gras_userdata_set(void *ud);
+
+/**
+ * gras_userdata_new:
+ *
+ * Malloc and set the data associated with the current process.
+ */
+
+#define gras_userdata_new(type) gras_userdata_set(malloc(sizeof(type)))
+
+END_DECL
+
+#endif /* GRAS_PROCESS_H */
+
index 0d8517a..aa088af 100644 (file)
 #include "gras/set.h"
 #include "gras/config.h"
 
 #include "gras/set.h"
 #include "gras/config.h"
 
-//#include "gras/data_description.h"
-//#include "gras/dd_type_bag.h"
-
 #include "gras/core.h"
 #include "gras/core.h"
+#include "gras/process.h"
 #include "gras/transport.h"
 #include "gras/transport.h"
-//#include "gras/datadesc_simple.h"
 #include "gras/datadesc.h"
 #include "gras/socket.h"
 #include "gras/messages.h"
 #include "gras/datadesc.h"
 #include "gras/socket.h"
 #include "gras/messages.h"
@@ -138,19 +135,18 @@ struct gras_msgheader_s {
 };
 
 /**
 };
 
 /**
- * grasProcessData_t:
+ * gras_process_data_t:
  *
  * Data for each process 
  */
 typedef struct {
   /* queue of messages which where received but not wanted in msgWait, and therefore
      temporarly queued until the next msgHandle */
  *
  * Data for each process 
  */
 typedef struct {
   /* queue of messages which where received but not wanted in msgWait, and therefore
      temporarly queued until the next msgHandle */
-  int grasMsgQueueLen;
-  gras_msg_t **grasMsgQueue;
+  gras_dynar_t *msg_queue; /* elm type: gras_msg_t */
 
   /* registered callbacks for each message */
 
   /* registered callbacks for each message */
-  int grasCblListLen;
-  gras_cblist_t *grasCblList;
+  gras_dynar_t *cbl_list; /* elm type: gras_cblist_t */
+   
 
   /* The channel we are listening to in SG for formated messages */
   int chan;
 
   /* The channel we are listening to in SG for formated messages */
   int chan;
@@ -159,7 +155,7 @@ typedef struct {
 
   /* globals of the process */
   void *userdata;               
 
   /* globals of the process */
   void *userdata;               
-} grasProcessData_t;
+} gras_process_data_t;
 
 
 /*@unused@*/static const DataDescriptor headerDescriptor[] =
 
 
 /*@unused@*/static const DataDescriptor headerDescriptor[] =
@@ -191,11 +187,11 @@ typedef struct {
 gras_msgentry_t * grasMsgEntryGet(gras_msgid_t id);
 
 /**
 gras_msgentry_t * grasMsgEntryGet(gras_msgid_t id);
 
 /**
- * grasProcessDataGet: 
+ * gras_process_data_get: 
  * 
  * Get the GRAS globals for this host
  */ /*@observer@*/
  * 
  * Get the GRAS globals for this host
  */ /*@observer@*/
-grasProcessData_t *grasProcessDataGet(void);
+gras_process_data_t *gras_process_data_get(void);
 
 /**
  * gras_cb_get: 
 
 /**
  * gras_cb_get: