From: mquinson Date: Wed, 3 Mar 2004 18:32:40 +0000 (+0000) Subject: split process.h (init/exit process; get/set userdata) out of core.h (unsorted stuff) X-Git-Tag: v3.3~5291 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/deae77799e9e84938001bed044c63a9f60eb3548 split process.h (init/exit process; get/set userdata) out of core.h (unsorted stuff) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@55 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/core.h b/include/core.h index f487dc1e34..acabba10e9 100644 --- a/include/core.h +++ b/include/core.h @@ -42,47 +42,6 @@ BEGIN_DECL * **************************************************************************/ 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 diff --git a/include/gras.h b/include/gras.h index c72909ba2c..39fd95d791 100644 --- a/include/gras.h +++ b/include/gras.h @@ -40,6 +40,8 @@ #include #include +#include + #include #include diff --git a/include/process.h b/include/process.h new file mode 100644 index 0000000000..76c2659805 --- /dev/null +++ b/include/process.h @@ -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 /* offsetof() */ +#include /* size_t */ +#include + + +/*! 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 */ + diff --git a/src/gras/gras_private.h b/src/gras/gras_private.h index 0d8517aca6..aa088af277 100644 --- a/src/gras/gras_private.h +++ b/src/gras/gras_private.h @@ -40,12 +40,9 @@ #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/process.h" #include "gras/transport.h" -//#include "gras/datadesc_simple.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 */ - int grasMsgQueueLen; - gras_msg_t **grasMsgQueue; + gras_dynar_t *msg_queue; /* elm type: gras_msg_t */ /* 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; @@ -159,7 +155,7 @@ typedef struct { /* globals of the process */ void *userdata; -} grasProcessData_t; +} gras_process_data_t; /*@unused@*/static const DataDescriptor headerDescriptor[] = @@ -191,11 +187,11 @@ typedef struct { gras_msgentry_t * grasMsgEntryGet(gras_msgid_t id); /** - * grasProcessDataGet: + * gras_process_data_get: * * Get the GRAS globals for this host */ /*@observer@*/ -grasProcessData_t *grasProcessDataGet(void); +gras_process_data_t *gras_process_data_get(void); /** * gras_cb_get: