]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_bwres_robjs.c
add get budget and period
[frescor/fna.git] / src_frescan / frescan_bwres_robjs.c
index 01e051b4c11d19a7b1bd13b95d055e7f6929cc9f..cdf29151d4abbd28445123d71f64fcfb4dcdab6c 100644 (file)
  *
  * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
  *
+ * @license
+ *
+ * -----------------------------------------------------------------------
+ *  Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+ *
+ *    Universidad de Cantabria,              SPAIN
+ *    University of York,                    UK
+ *    Scuola Superiore Sant'Anna,            ITALY
+ *    Kaiserslautern University,             GERMANY
+ *    Univ. Politécnica  Valencia,           SPAIN
+ *    Czech Technical University in Prague,  CZECH REPUBLIC
+ *    ENEA                                   SWEDEN
+ *    Thales Communication S.A.              FRANCE
+ *    Visual Tools S.A.                      SPAIN
+ *    Rapita Systems Ltd                     UK
+ *    Evidence                               ITALY
+ *
+ *    See http://www.frescor.org for a link to partners' websites
+ *
+ *           FRESCOR project (FP6/2005/IST/5-034026) is funded
+ *        in part by the European Union Sixth Framework Programme
+ *        The European Union is not liable of any use that may be
+ *        made of this code.
+ *
+ *  This file is part of FRESCAN
+ *
+ *  FRESCAN is free software; you can  redistribute it and/or  modify
+ *  it under the terms of  the GNU General Public License as published by
+ *  the Free Software Foundation;  either  version 2, or (at  your option)
+ *  any later version.
+ *
+ *  FRESCAN  is distributed  in  the hope  that  it  will  be useful,  but
+ *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
+ *  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
+ *  General Public License for more details.
+ *
+ *  You should have  received a  copy of  the  GNU  General Public License
+ *  distributed  with  FRESCAN;  see file COPYING.   If not,  write to the
+ *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
+ *  02111-1307, USA.
+ *
+ * As a special exception, including FRESCAN header files in a file,
+ * instantiating FRESCAN generics or templates, or linking other files
+ * with FRESCAN objects to produce an executable application, does not
+ * by itself cause the resulting executable application to be covered
+ * by the GNU General Public License. This exception does not
+ * however invalidate any other reasons why the executable file might be
+ * covered by the GNU Public License.
+ * -----------------------------------------------------------------------
+ *
  */
 
 #include <misc/freelist.h>
@@ -43,7 +93,7 @@ struct replyobj_t {
         fosa_mutex_t mutex;
 };
 
-static struct replyobj_t the_reply_objects[FRESCAN_MX_REPLY_OBJECTS];
+static struct replyobj_t the_reply_objects[FRESCAN_BWRES_MX_REPLY_OBJECTS];
 static freelist_t freelist;
 
 /**
@@ -62,7 +112,7 @@ int frescan_bwres_robjs_init(int max_ceiling)
         err = fosa_mutex_init(&freelist_mutex, max_ceiling);
         if (err != 0) return err;
 
-        err = freelist_init(&freelist, FRESCAN_MX_REPLY_OBJECTS);
+        err = freelist_init(&freelist, FRESCAN_BWRES_MX_REPLY_OBJECTS);
         if (err != 0) return err;
 
         is_initialized = true;
@@ -78,11 +128,11 @@ int frescan_bwres_robjs_init(int max_ceiling)
  *
  **/
 
-int frescan_bwres_robjs_alloc(frescan_robj_id_t *id, int ceiling)
+int frescan_bwres_robjs_alloc(frescan_bwres_robj_id_t *id, int ceiling)
 {
         int err, pos;
 
-        DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_ROBJS_ENABLE_DEBUG,
               "allocating reply object, is_initialized=%d\n", is_initialized);
 
         if (is_initialized == false) return -1;
@@ -105,7 +155,7 @@ int frescan_bwres_robjs_alloc(frescan_robj_id_t *id, int ceiling)
         err = fosa_mutex_init(&the_reply_objects[pos].mutex, ceiling);
         if (err != 0) return err;
 
-        DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_ROBJS_ENABLE_DEBUG,
               "reply object allocated, id=%d\n", *id);
 
         return 0;
@@ -122,11 +172,11 @@ locked_error:
  *
  **/
 
-int frescan_bwres_robjs_free(frescan_robj_id_t id)
+int frescan_bwres_robjs_free(frescan_bwres_robj_id_t id)
 {
         int err;
 
-        DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_ROBJS_ENABLE_DEBUG,
               "free reply id=%d, is_initialized=%d\n", id, is_initialized);
 
         if (is_initialized == false) return -1;
@@ -162,22 +212,22 @@ locked_error:
  *
  **/
 
-int frescan_bwres_robjs_signal(frescan_robj_id_t id)
+int frescan_bwres_robjs_signal(frescan_bwres_robj_id_t id)
 {
         int err;
 
-        DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_ROBJS_ENABLE_DEBUG,
               "is_initialized=%d\n", is_initialized);
         if (is_initialized == false) return -1;
 
-        DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+        DEBUG(FRESCAN_BWRES_ROBJS_ENABLE_DEBUG,
               "taking mutex of the reply id=%d\n", id);
         err = fosa_mutex_lock(&the_reply_objects[id].mutex);
         if (err != 0) return err;
 
                 the_reply_objects[id].is_work_done = true;
 
-                DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+                DEBUG(FRESCAN_BWRES_ROBJS_ENABLE_DEBUG,
                       "signal the cond variable\n");
                 err = fosa_cond_signal(&the_reply_objects[id].cond);
                 if (err != 0) goto locked_error;
@@ -188,7 +238,7 @@ int frescan_bwres_robjs_signal(frescan_robj_id_t id)
         return 0;
 
 locked_error:
-        ERROR("locked error %d\n", err);
+        FRESCAN_ERROR("locked error %d\n", err);
         fosa_mutex_unlock(&the_reply_objects[id].mutex);
         return err;
 }
@@ -200,7 +250,7 @@ locked_error:
  *
  **/
 
-int frescan_bwres_robjs_wait(frescan_robj_id_t id)
+int frescan_bwres_robjs_wait(frescan_bwres_robj_id_t id)
 {
         int err;
 
@@ -234,7 +284,7 @@ locked_error:
  *
  **/
 
-int frescan_bwres_robjs_timedwait(frescan_robj_id_t id,
+int frescan_bwres_robjs_timedwait(frescan_bwres_robj_id_t id,
                                   const struct timespec *abstime)
 {
         int err;