]> rtime.felk.cvut.cz Git - frescor/fosa.git/commitdiff
BUGFIX: Added (needed!) frsh_fosa.c source file
authorfaggioli <faggioli@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Thu, 14 Jun 2007 18:52:46 +0000 (18:52 +0000)
committerfaggioli <faggioli@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Thu, 14 Jun 2007 18:52:46 +0000 (18:52 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@492 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_aquosa/frsh_fosa.c [new file with mode: 0644]

diff --git a/src_aquosa/frsh_fosa.c b/src_aquosa/frsh_fosa.c
new file mode 100644 (file)
index 0000000..a16040f
--- /dev/null
@@ -0,0 +1,149 @@
+// -----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//
+//    Universidad de Cantabria,              SPAIN
+//    University of York,                    UK
+//    Scuola Superiore Sant'Anna,            ITALY
+//    Kaiserslautern University,             GERMANY
+//    Univ. Politecnica  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 the FRSH implementation
+//
+//  FRSH 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.
+//
+//  FRSH  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  FRSH;  see file COPYING.   If not,  write to the
+//  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
+//  02111-1307, USA.
+//
+// -----------------------------------------------------------------------
+//frsh_fosa.c
+//==============================================
+//  ********  ******    ********  **********
+//  **///// /**    **  **//////  /**     /**
+//  **      /**    ** /**        /**     /**
+//  ******* /**    ** /********* /**********
+//  **////  /**    ** ////////** /**//////**
+//  **      /**    **        /** /**     /**
+//  **      /**    **  ********  /**     /**
+//  //       /******/  ////////   //      // 
+//
+// FOSA(Frescor Operating System Adaptation layer)
+//================================================
+
+#include "frsh_fosa.h"
+#include <pthread.h>
+#include <stdio.h>
+
+/*************************
+ * Thread attributes
+ *************************/ 
+
+/**
+ * frsh_thread_attr_init()
+ *
+ * Initialize a thread attributes object
+ *
+ * This function initializes the object pointed to by attr to all 
+ * the default values defined by FRSH
+ *
+ * @return 0 if successful; otherwise it returns \n
+ *   FOSA_ENOMEM: insufficient memory exists to initialize the thread 
+ *           attributes object
+ **/
+int frsh_thread_attr_init(frsh_thread_attr_t *attr)
+{
+  int ret_value;
+
+  ret_value=pthread_attr_init(attr);
+  /*if (ret_value==0) {
+    // set the default values
+
+    // detachstate = detached thread (no join operation allowed)
+    CHK(pthread_attr_setdetachstate(attr,PTHREAD_CREATE_DETACHED));
+
+    // inheritsched = explicit, so that we can explicitly set the attributes
+    CHK(pthread_attr_setinheritsched(attr,PTHREAD_EXPLICIT_SCHED));
+    
+    // schedpolicy = fixed priorities
+    CHK(pthread_attr_setschedpolicy(attr,SCHED_FIFO));
+
+    // detachstate = detached thread (no join operation allowed)
+    CHK(pthread_attr_setdetachstate(attr,PTHREAD_CREATE_DETACHED));
+
+  }*/
+  return ret_value;
+}
+
+/**
+ * frsh_thread_attr_destroy()
+ *
+ * Destroy a thread attributes object
+ *
+ * This function is used to destroy the thread attributes object,
+ * pointed to by attr, and deallocate any system resources allocated for it
+ * 
+ * Returns 0
+ */
+int frsh_thread_attr_destroy(frsh_thread_attr_t *attr)
+{
+  return pthread_attr_destroy(attr);
+}
+
+/**
+ * frsh_thread_attr_set_stacksize()
+ *
+ * Set the thread minimum stack size in a thread attributes object
+ *
+ * This function sets the minimum stack size of the thread attributes
+ * object attr to the value given by stacksize, in bytes. This
+ * function has no runtime effect on the stack size, except when the
+ * attributes object is used to create a thread, when it will be
+ * created with the specified minimum stack size
+ * 
+ * @return 0 if successful, or the following error code:
+ *    FOSA_EINVAL: the specified stacksize  value is not supported in
+ *            this implementation
+ */
+int frsh_thread_attr_set_stacksize
+     (frsh_thread_attr_t *attr, size_t stacksize)
+{
+  return pthread_attr_setstacksize(attr,stacksize);
+}
+
+/**
+ * frsh_thread_attr_get_stacksize()
+ *
+ * Get the thread minimum stack size from a thread attributes object
+ *
+ * This function sets the variable pointed to by stacksize to the
+ * minimum stack size stored in the thread attributes object attr.
+ * 
+ * @return 0
+ */
+int frsh_thread_attr_get_stacksize
+      (const frsh_thread_attr_t *attr, size_t *stacksize)
+{
+  return pthread_attr_getstacksize(attr,stacksize);
+}