]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - src_marte/fosa_clocks_and_timers.c
Migrating FOSA trunk to d-ac2v2. Phase 1 moving FRSH-FOSA to FOSA
[frescor/fosa.git] / src_marte / fosa_clocks_and_timers.c
index 39befe1757e63b151592bf3d5bf39c0f5c264219..03f0b68e2c8d0a685d528fa3648cd6bc08af0b4c 100644 (file)
@@ -1,5 +1,5 @@
-// -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//----------------------------------------------------------------------
+//  Copyright (C) 2006 - 2007 by the FRESCOR consortium:
 //
 //    Universidad de Cantabria,              SPAIN
 //    University of York,                    UK
 //    Rapita Systems Ltd                     UK
 //    Evidence                               ITALY
 //
-//    See http://www.frescor.org for a link to partners' websites
+//    See http://www.frescor.org
 //
-//           FRESCOR project (FP6/2005/IST/5-034026) is funded
+//        The 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.
+//  based on previous work (FSF) done in the FIRST project
+//
+//   Copyright (C) 2005  Mälardalen University, SWEDEN
+//                       Scuola Superiore S.Anna, ITALY
+//                       Universidad de Cantabria, SPAIN
+//                       University of York, UK
 //
-//  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.
+// This file is part of FOSA (Frsh Operating System Abstraction)
 //
-//  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.
+// FOSA is free software; you can redistribute it and/or modify it
+// under terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option) any
+// later version.  FOSA 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 along with FOSA; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
 //
+// As a special exception, including FOSA header files in a file,
+// instantiating FOSA generics or templates, or linking other files
+// with FOSA 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.
 // -----------------------------------------------------------------------
 //fosa_clocks_and_timers.c
 //==============================================
@@ -104,7 +115,7 @@ int fosa_clock_get_time(fosa_clock_id_t clockid, struct timespec *current_time)
  * implementation and dependant applications
  **/
 int fosa_thread_get_cputime_clock
-    (frsh_thread_id_t tid, fosa_clock_id_t *clockid)
+    (fosa_thread_id_t tid, fosa_clock_id_t *clockid)
 {
   return pthread_getcpuclockid(tid,clockid);
 }
@@ -148,7 +159,7 @@ int fosa_thread_get_cputime_clock
  * implementation and dependant applications
  **/
  int fosa_timer_create
-      (fosa_clock_id_t clockid, frsh_signal_t signal, frsh_signal_info_t info,
+      (fosa_clock_id_t clockid, fosa_signal_t signal, fosa_signal_info_t info,
        fosa_timer_id_t *timerid)
 {
   struct sigevent evp;
@@ -160,6 +171,33 @@ int fosa_thread_get_cputime_clock
   return timer_create(clockid,&evp,timerid);
 }
 
+/**
+ * fosa_timer_create_with_receiver()
+ *
+ * Create a one-shot timer with a specific signal receiver thread
+ *
+ * This function creates a timer in the same way as fosa_timer_create,
+ * except that the signal generated when the timer expires is sent to
+ * the thread specified by receiver
+ *
+ * Returns 0 if successful; otherwise it returns an error code:
+ *     FOSA_EINVAL: the value of clockid or signal is invalid
+ *
+ *     FOSA_EAGAIN: the system lacks enough resources to create the timer
+ *
+ * Alternatively, in case of error the implementation is allowed to
+ * notify it to the system console and then terminate the FRSH
+ * implementation and dependant applications
+ **/
+ int fosa_timer_create_with_receiver
+      (fosa_clock_id_t clockid, fosa_signal_t signal, fosa_signal_info_t info,
+       fosa_timer_id_t *timerid, fosa_thread_id_t receiver)
+{
+  // in POSIX the receiver thread cannot be specified
+  return fosa_timer_create(clockid,signal,info,timerid);
+}
+
+
 /**
  * Delete a timer
  *