Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Details of this changes:
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 8 Jul 2008 12:31:06 +0000 (12:31 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 8 Jul 2008 12:31:06 +0000 (12:31 +0000)
src/msg/private.h
export msg_global for MSG4C++
extern C for C compatibility on C++ compilers
renaming using fields in refcount

src/msg/mailbox.c
src/msg/task.c
src/msg/gos.c
src/xbt/xbt_sg_synchro.c
src/simix/private.h
src/simix/smx_synchro.c
src/include/surf/surf.h
src/surf/cpu.c
src/surf/network.c
src/surf/workstation_ptask_L07.c
src/surf/network_constant.c

renaming using fields in refcount

src/msg/mailbox.h
export some mailbox functions for MSG4C++

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5861 48e7efb5-ca39-0410-a469-dd3cf9ba447f

14 files changed:
src/include/surf/surf.h
src/java/jmsg.c
src/msg/gos.c
src/msg/mailbox.h
src/msg/msg_mailbox.c
src/msg/private.h
src/msg/task.c
src/simix/private.h
src/simix/smx_synchro.c
src/surf/cpu.c
src/surf/network.c
src/surf/network_constant.c
src/surf/workstation_ptask_L07.c
src/xbt/xbt_sg_synchro.c

index 308dd05..6d14f9a 100644 (file)
@@ -75,7 +75,7 @@ typedef struct surf_action {
   double finish;               /**< finish time : this is modified during the run
                                 * and fluctuates until the task is completed */
   void *data;                  /**< for your convenience */
   double finish;               /**< finish time : this is modified during the run
                                 * and fluctuates until the task is completed */
   void *data;                  /**< for your convenience */
-  int using;
+  int refcount ;
   surf_model_t model_type;
 } s_surf_action_t;
 
   surf_model_t model_type;
 } s_surf_action_t;
 
index 681c19e..cff2db5 100644 (file)
@@ -119,7 +119,8 @@ Java_simgrid_msg_MsgNative_processCreate(JNIEnv* env, jclass cls, jobject jproce
   SIMIX_jprocess_create(process->name,
                        process->simdata->m_host->simdata->smx_host, 
                        /*data*/ (void*)process,
   SIMIX_jprocess_create(process->name,
                        process->simdata->m_host->simdata->smx_host, 
                        /*data*/ (void*)process,
-                       jprocess,env,
+                       jprocess,
+                       env,
                        &process->simdata->s_process);
 
   
                        &process->simdata->s_process);
 
   
index ed5e702..8d5cf00 100644 (file)
@@ -45,11 +45,11 @@ MSG_task_execute(m_task_t task)
        CHECK_HOST();
        
        simdata = task->simdata;
        CHECK_HOST();
        
        simdata = task->simdata;
-       xbt_assert0((!simdata->compute) && (task->simdata->using == 1),"This task is executed somewhere else. Go fix your code!");
+       xbt_assert0((!simdata->compute) && (task->simdata->refcount  == 1),"This task is executed somewhere else. Go fix your code!");
        
        DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
        
        
        DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
        
-       simdata->using++;
+       simdata->refcount ++;
        SIMIX_mutex_lock(simdata->mutex);
        simdata->compute = SIMIX_action_execute(SIMIX_host_self(), task->name, simdata->computation_amount);
        SIMIX_action_set_priority(simdata->compute, simdata->priority);
        SIMIX_mutex_lock(simdata->mutex);
        simdata->compute = SIMIX_action_execute(SIMIX_host_self(), task->name, simdata->computation_amount);
        SIMIX_action_set_priority(simdata->compute, simdata->priority);
@@ -61,7 +61,7 @@ MSG_task_execute(m_task_t task)
        self->simdata->waiting_task = NULL;
        
        SIMIX_mutex_unlock(simdata->mutex);
        self->simdata->waiting_task = NULL;
        
        SIMIX_mutex_unlock(simdata->mutex);
-       simdata->using--;
+       simdata->refcount --;
        
        if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE) 
        {
        
        if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE) 
        {
@@ -129,7 +129,7 @@ MSG_parallel_task_create(const char *name,int host_nb, const m_host_t * host_lis
        simdata->compute = NULL;
        simdata->comm = NULL;
        simdata->rate = -1.0;
        simdata->compute = NULL;
        simdata->comm = NULL;
        simdata->rate = -1.0;
-       simdata->using = 1;
+       simdata->refcount  = 1;
        simdata->sender = NULL;
        simdata->receiver = NULL;
        simdata->source = NULL;
        simdata->sender = NULL;
        simdata->receiver = NULL;
        simdata->source = NULL;
@@ -154,13 +154,13 @@ MSG_parallel_task_execute(m_task_t task)
        
        simdata = task->simdata;
        
        
        simdata = task->simdata;
        
-       xbt_assert0((!simdata->compute) && (task->simdata->using == 1),"This task is executed somewhere else. Go fix your code!");
+       xbt_assert0((!simdata->compute) && (task->simdata->refcount  == 1),"This task is executed somewhere else. Go fix your code!");
        
        xbt_assert0(simdata->host_nb,"This is not a parallel task. Go to hell.");
        
        DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
        
        
        xbt_assert0(simdata->host_nb,"This is not a parallel task. Go to hell.");
        
        DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
        
-       simdata->using++;
+       simdata->refcount ++;
        
        SIMIX_mutex_lock(simdata->mutex);
        simdata->compute =
        
        SIMIX_mutex_lock(simdata->mutex);
        simdata->compute =
@@ -174,7 +174,7 @@ MSG_parallel_task_execute(m_task_t task)
        
        
        SIMIX_mutex_unlock(simdata->mutex);
        
        
        SIMIX_mutex_unlock(simdata->mutex);
-       simdata->using--;
+       simdata->refcount --;
        
        if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE) 
        {
        
        if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE) 
        {
index 640e7ab..89fbf09 100644 (file)
@@ -27,7 +27,8 @@ void MSG_mailbox_mod_exit(void);
  * 
  * \return             The newly created mailbox.
  */
  * 
  * \return             The newly created mailbox.
  */
-msg_mailbox_t MSG_mailbox_new(const char *alias);
+XBT_PUBLIC(msg_mailbox_t)
+MSG_mailbox_new(const char *alias);
 
 /*! \brief MSG_mailbox_create - create a new mailbox.
  *
 
 /*! \brief MSG_mailbox_create - create a new mailbox.
  *
@@ -40,7 +41,8 @@ msg_mailbox_t MSG_mailbox_new(const char *alias);
  * 
  * \return             The newly created mailbox.
  */
  * 
  * \return             The newly created mailbox.
  */
-msg_mailbox_t MSG_mailbox_create(const char *alias);
+msg_mailbox_t
+MSG_mailbox_create(const char *alias);
 
 /* \brief MSG_mailbox_free - release a mailbox from the memory.
  *
 
 /* \brief MSG_mailbox_free - release a mailbox from the memory.
  *
@@ -51,7 +53,8 @@ msg_mailbox_t MSG_mailbox_create(const char *alias);
  *
  * \see                        MSG_mailbox_destroy.
  */
  *
  * \see                        MSG_mailbox_destroy.
  */
-void MSG_mailbox_free(void *mailbox);
+void
+MSG_mailbox_free(void *mailbox);
 
 /* \brief MSG_mailbox_get_by_alias - get a mailbox from its alias.
  *
 
 /* \brief MSG_mailbox_get_by_alias - get a mailbox from its alias.
  *
@@ -64,7 +67,8 @@ void MSG_mailbox_free(void *mailbox);
  * \return     The mailbox associated with the alias specified as parameter
  *             or a new mailbox if the key does not match.
  */
  * \return     The mailbox associated with the alias specified as parameter
  *             or a new mailbox if the key does not match.
  */
-msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias);
+XBT_PUBLIC(msg_mailbox_t)
+MSG_mailbox_get_by_alias(const char *alias);
 
 /* \brief MSG_mailbox_get_by_channel - get a mailbox of the specified host from its channel.
  *
 
 /* \brief MSG_mailbox_get_by_channel - get a mailbox of the specified host from its channel.
  *
@@ -79,7 +83,7 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias);
  *         specified as parameter.
  *             
  */
  *         specified as parameter.
  *             
  */
-msg_mailbox_t
+XBT_PUBLIC(msg_mailbox_t)
 MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
 
 /*! \brief MSG_mailbox_get_alias - get the alias associated with the mailbox.
 MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
 
 /*! \brief MSG_mailbox_get_alias - get the alias associated with the mailbox.
@@ -91,7 +95,8 @@ MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
  *
  * \return     The alias of the mailbox specified by the parameter mailbox.
  */
  *
  * \return     The alias of the mailbox specified by the parameter mailbox.
  */
-const char *MSG_mailbox_get_alias(msg_mailbox_t mailbox);
+XBT_PUBLIC(const char *)
+MSG_mailbox_get_alias(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_get_cond - get the simix condition of a mailbox.
  *
 
 /*! \brief MSG_mailbox_get_cond - get the simix condition of a mailbox.
  *
@@ -102,7 +107,8 @@ const char *MSG_mailbox_get_alias(msg_mailbox_t mailbox);
  *
  * \return The simix condition of the mailbox specified by the parameter mailbox.
  */
  *
  * \return The simix condition of the mailbox specified by the parameter mailbox.
  */
-smx_cond_t MSG_mailbox_get_cond(msg_mailbox_t mailbox);
+XBT_PUBLIC(smx_cond_t)
+MSG_mailbox_get_cond(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_set_cond - set the simix condition of a mailbox.
  *
 
 /*! \brief MSG_mailbox_set_cond - set the simix condition of a mailbox.
  *
@@ -113,7 +119,8 @@ smx_cond_t MSG_mailbox_get_cond(msg_mailbox_t mailbox);
  * \param cond         The new simix condition of the mailbox.
  *
  */
  * \param cond         The new simix condition of the mailbox.
  *
  */
-void MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
+XBT_PUBLIC(void)
+MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
 
 /*! \brief MSG_mailbox_get_hostname - get the name of the host owned a mailbox.
  *
 
 /*! \brief MSG_mailbox_get_hostname - get the name of the host owned a mailbox.
  *
@@ -124,7 +131,8 @@ void MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
  *
  * \return The name of the host owned the mailbox specified by the parameter mailbox.
  */
  *
  * \return The name of the host owned the mailbox specified by the parameter mailbox.
  */
-const char *MSG_mailbox_get_hostname(msg_mailbox_t mailbox);
+XBT_PUBLIC(const char *)
+MSG_mailbox_get_hostname(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_set_hostname - set the name of the host owned a mailbox.
  *
 
 /*! \brief MSG_mailbox_set_hostname - set the name of the host owned a mailbox.
  *
@@ -135,7 +143,8 @@ const char *MSG_mailbox_get_hostname(msg_mailbox_t mailbox);
  * \param hostname     The name of the owner of the mailbox.
  *
  */
  * \param hostname     The name of the owner of the mailbox.
  *
  */
-void MSG_mailbox_set_hostname(msg_mailbox_t mailbox, const char *hostname);
+XBT_PUBLIC(void)
+MSG_mailbox_set_hostname(msg_mailbox_t mailbox, const char *hostname);
 
 
 /*! \brief MSG_mailbox_is_empty - test if a mailbox is empty.
 
 
 /*! \brief MSG_mailbox_is_empty - test if a mailbox is empty.
@@ -148,7 +157,8 @@ void MSG_mailbox_set_hostname(msg_mailbox_t mailbox, const char *hostname);
  * \return     The function returns 1 if the mailbox is empty. Otherwise the function
  *             returns 0.
  */
  * \return     The function returns 1 if the mailbox is empty. Otherwise the function
  *             returns 0.
  */
-int MSG_mailbox_is_empty(msg_mailbox_t mailbox);
+XBT_PUBLIC(int)
+MSG_mailbox_is_empty(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_put - put a task in a mailbox.
  *
 
 /*! \brief MSG_mailbox_put - put a task in a mailbox.
  *
@@ -157,7 +167,8 @@ int MSG_mailbox_is_empty(msg_mailbox_t mailbox);
  * \param mailbox      The mailbox where put the task.
  * \param task         The task to put in the mailbox.
  */
  * \param mailbox      The mailbox where put the task.
  * \param task         The task to put in the mailbox.
  */
-void MSG_mailbox_put(msg_mailbox_t mailbox, m_task_t task);
+XBT_PUBLIC(void)
+MSG_mailbox_put(msg_mailbox_t mailbox, m_task_t task);
 
 /*! \brief MSG_mailbox_remove - remove a task from a mailbox.
  *
 
 /*! \brief MSG_mailbox_remove - remove a task from a mailbox.
  *
@@ -166,7 +177,8 @@ void MSG_mailbox_put(msg_mailbox_t mailbox, m_task_t task);
  * \param mailbox      The mailbox concerned by this operation.
  * \param task         The task to remove from the mailbox.
  */
  * \param mailbox      The mailbox concerned by this operation.
  * \param task         The task to remove from the mailbox.
  */
-void MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
+XBT_PUBLIC(void)
+MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
 
 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
  *
 
 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
  *
@@ -178,7 +190,8 @@ void MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
  *
  * \return             The task at the head of the mailbox.
  */
  *
  * \return             The task at the head of the mailbox.
  */
-m_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox);
+XBT_PUBLIC(m_task_t)
+MSG_mailbox_get_head(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_pop_head - get the task at the head of a mailbox
  * and remove it from it.
 
 /*! \brief MSG_mailbox_pop_head - get the task at the head of a mailbox
  * and remove it from it.
@@ -190,7 +203,8 @@ m_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox);
  *
  * \return             The task at the head of the mailbox.
  */
  *
  * \return             The task at the head of the mailbox.
  */
-m_task_t MSG_mailbox_pop_head(msg_mailbox_t mailbox);
+XBT_PUBLIC(m_task_t)
+MSG_mailbox_pop_head(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_get_first_host_task - get the first msg task
  * of a specified mailbox, sended by a process of a specified host.
 
 /*! \brief MSG_mailbox_get_first_host_task - get the first msg task
  * of a specified mailbox, sended by a process of a specified host.
@@ -203,7 +217,7 @@ m_task_t MSG_mailbox_pop_head(msg_mailbox_t mailbox);
  *                     parameter mailbox and sended by a process located
  *                     on the host specified by the parameter host.
  */
  *                     parameter mailbox and sended by a process located
  *                     on the host specified by the parameter host.
  */
-m_task_t
+XBT_PUBLIC(m_task_t)
 MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
 
 /*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks 
 MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
 
 /*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks 
@@ -217,7 +231,7 @@ MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
  *                     parameter mailbox and sended by all the processes located
  *                     on the host specified by the parameter host.
  */
  *                     parameter mailbox and sended by all the processes located
  *                     on the host specified by the parameter host.
  */
-int
+XBT_PUBLIC(int)
 MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
                                         m_host_t host);
 
 MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
                                         m_host_t host);
 
index c023520..53e1bbf 100644 (file)
@@ -293,17 +293,17 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
   if (SIMIX_action_get_state(t_simdata->comm) == SURF_ACTION_DONE) {
     SIMIX_action_destroy(t_simdata->comm);
     t_simdata->comm = NULL;
   if (SIMIX_action_get_state(t_simdata->comm) == SURF_ACTION_DONE) {
     SIMIX_action_destroy(t_simdata->comm);
     t_simdata->comm = NULL;
-    t_simdata->using--;
+    t_simdata->refcount --;
     MSG_RETURN(MSG_OK);
   } else if (SIMIX_host_get_state(h_simdata->smx_host) == 0) {
     SIMIX_action_destroy(t_simdata->comm);
     t_simdata->comm = NULL;
     MSG_RETURN(MSG_OK);
   } else if (SIMIX_host_get_state(h_simdata->smx_host) == 0) {
     SIMIX_action_destroy(t_simdata->comm);
     t_simdata->comm = NULL;
-    t_simdata->using--;
+    t_simdata->refcount --;
     MSG_RETURN(MSG_HOST_FAILURE);
   } else {
     SIMIX_action_destroy(t_simdata->comm);
     t_simdata->comm = NULL;
     MSG_RETURN(MSG_HOST_FAILURE);
   } else {
     SIMIX_action_destroy(t_simdata->comm);
     t_simdata->comm = NULL;
-    t_simdata->using--;
+    t_simdata->refcount --;
     MSG_RETURN(MSG_TRANSFER_FAILURE);
   }
 }
     MSG_RETURN(MSG_TRANSFER_FAILURE);
   }
 }
@@ -325,12 +325,12 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
   task_simdata->sender = process;
   task_simdata->source = MSG_process_get_host(process);
 
   task_simdata->sender = process;
   task_simdata->source = MSG_process_get_host(process);
 
-  xbt_assert0(task_simdata->using == 1,
+  xbt_assert0(task_simdata->refcount  == 1,
              "This task is still being used somewhere else. You cannot send it now. Go fix your code!");
 
   task_simdata->comm = NULL;
 
              "This task is still being used somewhere else. You cannot send it now. Go fix your code!");
 
   task_simdata->comm = NULL;
 
-  task_simdata->using++;
+  task_simdata->refcount ++;
   local_host = ((simdata_process_t) process->simdata)->m_host;
 
   /* get the host name containing the mailbox */
   local_host = ((simdata_process_t) process->simdata)->m_host;
 
   /* get the host name containing the mailbox */
index b7a62ba..9f95cee 100644 (file)
@@ -21,6 +21,8 @@
 #include "xbt/context.h"
 #include "xbt/config.h"
 
 #include "xbt/context.h"
 #include "xbt/config.h"
 
+SG_BEGIN_DECL()
+
 /**************** datatypes **********************************/
 
 /* this structure represents a mailbox */
 /**************** datatypes **********************************/
 
 /* this structure represents a mailbox */
@@ -53,7 +55,7 @@ typedef struct simdata_task {
   m_host_t source;
   double priority;
   double rate;
   m_host_t source;
   double priority;
   double rate;
-  int using;
+  int refcount ;
   /*******  Parallel Tasks Only !!!! *******/
   int host_nb;
   smx_host_t *host_list;
   /*******  Parallel Tasks Only !!!! *******/
   int host_nb;
   smx_host_t *host_list;
@@ -95,7 +97,9 @@ typedef struct MSG_Global {
   int session;
 } s_MSG_Global_t, *MSG_Global_t;
 
   int session;
 } s_MSG_Global_t, *MSG_Global_t;
 
-extern MSG_Global_t msg_global;
+/*extern MSG_Global_t msg_global;*/
+XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
+
       
 /*************************************************************/
 
       
 /*************************************************************/
 
@@ -119,5 +123,5 @@ void *_MSG_process_create_from_SIMIX(const char *name,
                                     char * hostname, int argc, char **argv, xbt_dict_t properties);
 void _MSG_process_kill_from_SIMIX(void *p);
 
                                     char * hostname, int argc, char **argv, xbt_dict_t properties);
 void _MSG_process_kill_from_SIMIX(void *p);
 
-
+SG_END_DECL()
 #endif
 #endif
index dea7d9b..0d6cd42 100644 (file)
@@ -61,7 +61,7 @@ m_task_t MSG_task_create(const char *name, double compute_duration,
   simdata->message_size = message_size;
   simdata->rate = -1.0;
   simdata->priority = 1.0;
   simdata->message_size = message_size;
   simdata->rate = -1.0;
   simdata->priority = 1.0;
-  simdata->using = 1;
+  simdata->refcount  = 1;
   simdata->sender = NULL;
   simdata->receiver = NULL;
   simdata->cond = SIMIX_cond_init();
   simdata->sender = NULL;
   simdata->receiver = NULL;
   simdata->cond = SIMIX_cond_init();
@@ -135,8 +135,8 @@ MSG_error_t MSG_task_destroy(m_task_t task)
   xbt_assert0((task != NULL), "Invalid parameter");
 
   /* why? if somebody is using, then you can't free! ok... but will return MSG_OK? when this task will be destroyed? isn't the user code wrong? */
   xbt_assert0((task != NULL), "Invalid parameter");
 
   /* why? if somebody is using, then you can't free! ok... but will return MSG_OK? when this task will be destroyed? isn't the user code wrong? */
-  task->simdata->using--;
-  if (task->simdata->using > 0)
+  task->simdata->refcount --;
+  if (task->simdata->refcount  > 0)
     return MSG_OK;
 
   if (task->name)
     return MSG_OK;
 
   if (task->name)
index dd2c343..4a7dd72 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: private.h 5071 2007-11-27 15:41:57Z mquinson $      */
+/*     $Id$     */
 
 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
    All rights reserved.                                          */
 
 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
    All rights reserved.                                          */
@@ -76,7 +76,7 @@ typedef struct s_smx_mutex {
 
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_mutex */
   xbt_swag_t sleeping;         /* list of sleeping process */
 
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_mutex */
   xbt_swag_t sleeping;         /* list of sleeping process */
-  int using;
+  int refcount ;
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_mutex */
 
 } s_smx_mutex_t;
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_mutex */
 
 } s_smx_mutex_t;
index 64d4d69..42d057b 100644 (file)
@@ -29,7 +29,7 @@ smx_mutex_t SIMIX_mutex_init()
   smx_mutex_t m = xbt_new0(s_smx_mutex_t, 1);
   s_smx_process_t p;           /* useful to initialize sleeping swag */
   /* structures initialization */
   smx_mutex_t m = xbt_new0(s_smx_mutex_t, 1);
   s_smx_process_t p;           /* useful to initialize sleeping swag */
   /* structures initialization */
-  m->using = 0;
+  m->refcount  = 0;
   m->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
   return m;
 }
   m->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
   return m;
 }
@@ -46,7 +46,7 @@ void SIMIX_mutex_lock(smx_mutex_t mutex)
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
 
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
 
-  if (mutex->using) {
+  if (mutex->refcount ) {
     /* somebody using the mutex, block */
     xbt_swag_insert(self, mutex->sleeping);
     self->simdata->mutex = mutex;
     /* somebody using the mutex, block */
     xbt_swag_insert(self, mutex->sleeping);
     self->simdata->mutex = mutex;
@@ -59,10 +59,10 @@ void SIMIX_mutex_lock(smx_mutex_t mutex)
       xbt_context_yield();
     }
 
       xbt_context_yield();
     }
 
-    mutex->using = 1;
+    mutex->refcount  = 1;
   } else {
     /* mutex free */
   } else {
     /* mutex free */
-    mutex->using = 1;
+    mutex->refcount  = 1;
   }
   return;
 }
   }
   return;
 }
@@ -78,10 +78,10 @@ int SIMIX_mutex_trylock(smx_mutex_t mutex)
 {
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
 {
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
-  if (mutex->using)
+  if (mutex->refcount )
     return 0;
   else {
     return 0;
   else {
-    mutex->using = 1;
+    mutex->refcount  = 1;
     return 1;
   }
 }
     return 1;
   }
 }
@@ -100,11 +100,11 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex)
 
   if (xbt_swag_size(mutex->sleeping) > 0) {
     p = xbt_swag_extract(mutex->sleeping);
 
   if (xbt_swag_size(mutex->sleeping) > 0) {
     p = xbt_swag_extract(mutex->sleeping);
-    mutex->using = 0;
+    mutex->refcount  = 0;
     xbt_swag_insert(p, simix_global->process_to_run);
   } else {
     /* nobody to wake up */
     xbt_swag_insert(p, simix_global->process_to_run);
   } else {
     /* nobody to wake up */
-    mutex->using = 0;
+    mutex->refcount  = 0;
   }
   return;
 }
   }
   return;
 }
index f300667..3814631 100644 (file)
@@ -146,8 +146,8 @@ static int resource_used(void *resource_id)
 
 static int action_free(surf_action_t action)
 {
 
 static int action_free(surf_action_t action)
 {
-  action->using--;
-  if (!action->using) {
+  action->refcount --;
+  if (!action->refcount ) {
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_cpu_Cas01_t) action)->variable)
       lmm_variable_free(cpu_maxmin_system,
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_cpu_Cas01_t) action)->variable)
       lmm_variable_free(cpu_maxmin_system,
@@ -160,7 +160,7 @@ static int action_free(surf_action_t action)
 
 static void action_use(surf_action_t action)
 {
 
 static void action_use(surf_action_t action)
 {
-  action->using++;
+  action->refcount ++;
 }
 
 static void action_cancel(surf_action_t action)
 }
 
 static void action_cancel(surf_action_t action)
@@ -273,7 +273,7 @@ static surf_action_t execute(void *cpu, double size)
   XBT_IN2("(%s,%g)", CPU->name, size);
   action = xbt_new0(s_surf_action_cpu_Cas01_t, 1);
 
   XBT_IN2("(%s,%g)", CPU->name, size);
   action = xbt_new0(s_surf_action_cpu_Cas01_t, 1);
 
-  action->generic_action.using = 1;
+  action->generic_action.refcount  = 1;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.priority = 1.0;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.priority = 1.0;
index 69a6d28..2c81953 100644 (file)
@@ -308,8 +308,8 @@ static int resource_used(void *resource_id)
 
 static int action_free(surf_action_t action)
 {
 
 static int action_free(surf_action_t action)
 {
-  action->using--;
-  if (!action->using) {
+  action->refcount --;
+  if (!action->refcount ) {
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_network_CM02_t) action)->variable)
       lmm_variable_free(network_maxmin_system,
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_network_CM02_t) action)->variable)
       lmm_variable_free(network_maxmin_system,
@@ -322,7 +322,7 @@ static int action_free(surf_action_t action)
 
 static void action_use(surf_action_t action)
 {
 
 static void action_use(surf_action_t action)
 {
-  action->using++;
+  action->refcount ++;
 }
 
 static void action_cancel(surf_action_t action)
 }
 
 static void action_cancel(surf_action_t action)
@@ -514,7 +514,7 @@ static surf_action_t communicate(void *src, void *dst, double size,
 
   action = xbt_new0(s_surf_action_network_CM02_t, 1);
 
 
   action = xbt_new0(s_surf_action_network_CM02_t, 1);
 
-  action->generic_action.using = 1;
+  action->generic_action.refcount  = 1;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.max_duration = NO_MAX_DURATION;
index 8316e17..1f06f33 100644 (file)
@@ -102,8 +102,8 @@ static int resource_used(void *resource_id)
 
 static int action_free(surf_action_t action)
 {
 
 static int action_free(surf_action_t action)
 {
-  action->using--;
-  if (!action->using) {
+  action->refcount --;
+  if (!action->refcount ) {
     xbt_swag_remove(action, action->state_set);
     free(action);
     return 1;
     xbt_swag_remove(action, action->state_set);
     free(action);
     return 1;
@@ -113,7 +113,7 @@ static int action_free(surf_action_t action)
 
 static void action_use(surf_action_t action)
 {
 
 static void action_use(surf_action_t action)
 {
-  action->using++;
+  action->refcount ++;
 }
 
 static void action_cancel(surf_action_t action)
 }
 
 static void action_cancel(surf_action_t action)
@@ -203,7 +203,7 @@ static surf_action_t communicate(void *src, void *dst, double size,
 
   action = xbt_new0(s_surf_action_network_Constant_t, 1);
 
 
   action = xbt_new0(s_surf_action_network_Constant_t, 1);
 
-  action->generic_action.using = 1;
+  action->generic_action.refcount  = 1;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.max_duration = NO_MAX_DURATION;
index f69cb1e..2e5f270 100644 (file)
@@ -144,15 +144,15 @@ static xbt_dict_t get_properties(void *r) {
 
 static void action_use(surf_action_t action)
 {
 
 static void action_use(surf_action_t action)
 {
-  action->using++;
+  action->refcount ++;
   return;
 }
 
 static int action_free(surf_action_t action)
 {
   return;
 }
 
 static int action_free(surf_action_t action)
 {
-  action->using--;
+  action->refcount --;
 
 
-  if (!action->using) {
+  if (!action->refcount ) {
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_workstation_L07_t) action)->variable)
       lmm_variable_free(ptask_maxmin_system,
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_workstation_L07_t) action)->variable)
       lmm_variable_free(ptask_maxmin_system,
@@ -521,7 +521,7 @@ static surf_action_t execute_parallel_task(int workstation_nb,
   action = xbt_new0(s_surf_action_workstation_L07_t, 1);
   DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.",
         action, workstation_nb, nb_link);
   action = xbt_new0(s_surf_action_workstation_L07_t, 1);
   DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.",
         action, workstation_nb, nb_link);
-  action->generic_action.using = 1;
+  action->generic_action.refcount  = 1;
   action->generic_action.cost = amount;
   action->generic_action.remains = amount;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.cost = amount;
   action->generic_action.remains = amount;
   action->generic_action.max_duration = NO_MAX_DURATION;
index 6500d93..e7c1586 100644 (file)
@@ -92,7 +92,7 @@ struct s_xbt_mutex_ {
    
    /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_mutex */
    xbt_swag_t sleeping;                        /* list of sleeping process */
    
    /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_mutex */
    xbt_swag_t sleeping;                        /* list of sleeping process */
-   int using;
+   int refcount ;
    /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_mutex */
    
 };
    /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_mutex */
    
 };