]> rtime.felk.cvut.cz Git - frescor/fosa.git/blobdiff - include/fosa_threads_and_signals.h
Moving fosa_signal_queue_scheduler() from threads_and_signals.h to
[frescor/fosa.git] / include / fosa_threads_and_signals.h
index b65912fd61c546f38f655c6a27fc637bcc561f8c..bc56e03fad117453c1932a6cb3b72a866b3226a5 100644 (file)
@@ -62,6 +62,8 @@
 #ifndef        FOSA_THREAD_AND_SIGNALS_H_
 #define        FOSA_THREAD_AND_SIGNALS_H_
 
+#include "fosa_types.h"
+
 /**
  * @defgroup threadandsignals Thread and Signals
  * @ingroup fosa
@@ -119,14 +121,14 @@ frsh_thread_id_t fosa_thread_self();
  *
  * Returns 0 if successful; otherwise it returs a code error:
  *
- *     EAGAIN: the system lacks the necessary resources to create a
+ *     FOSA_EAGAIN: the system lacks the necessary resources to create a
  *             new thread or the maximum number of threads has been
  *             reached
  *
- *     EINVAL: the value specified by attr is invalid (for instance,
+ *     FOSA_EINVAL: the value specified by attr is invalid (for instance,
  *              it has not been correctly initialized)
  *
- *     EREJECT: the cretion of the thread was rejected by the frsh scheduler
+ *     FOSA_EREJECT: the cretion of the thread was rejected by the frsh scheduler
  *               possibly because of incorrect attributes, or because the 
  *               requested minimum capacity cannot be guaranteed
  *
@@ -138,7 +140,7 @@ frsh_thread_id_t fosa_thread_self();
 
 /**
  * Note: no thread termination primitive is provided. The termination
- * of a thread will be notifoed by the system to the FRSH scheduler
+ * of a thread will be notified by the system to the FRSH scheduler
  * through the scheduler API
  **/
 
@@ -153,6 +155,34 @@ frsh_thread_id_t fosa_thread_self();
  * deallocating the memory area pointed to by the pointer
  **************************************************/ 
 
+/**
+ * fosa_key_create()
+ *
+ * Create a new key for thread specific data.
+ *
+ * Prior to setting data in a key, we need ask the system to create
+ * one for us.
+ *
+ * @return 0 if successful \n
+ *   FOSA_EINVAL If we already have reached the FOSA_MAX_KEYS limit.
+ *   FOSA_ENOMEM If there are no enough memory resources to 
+ *               create the key.
+ **/
+int fosa_key_create(int *key);
+
+/**
+ * fosa_key_destroy()
+ *
+ * Destroy a key
+ *
+ * This destroys the key and isables its use in the system
+ *
+ * @return 0 if successful \n
+ *   FOSA_EINVAL The key is not initialised or is not in FOSA key range.
+ **/
+int fosa_key_destroy(int key);
+
+
 /**
  * fosa_thread_set_specific_data()
  *
@@ -162,7 +192,7 @@ frsh_thread_id_t fosa_thread_self();
  * identified by key will be set to the value specified by value
  *
  * Returns 0 if successful; otherwise, an error code is returned
- *     EINVAL: the value of key is not between 0 and FOSA_MAX_KEYS-1
+ *     FOSA_EINVAL: the value of key is not between 0 and FOSA_MAX_KEYS-1
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
@@ -180,7 +210,7 @@ frsh_thread_id_t fosa_thread_self();
  * identified by key will be copied to the variable pointed to by value
  *
  * Returns 0 if successful; otherwise, an error code is returned
- *     EINVAL: the value of key is not between 0 and FOSA_MAX_KEYS-1
+ *     FOSA_EINVAL: the value of key is not between 0 and FOSA_MAX_KEYS-1
  *
  * Alternatively, in case of error the implementation is allowed to
  * notify it to the system console and then terminate the FRSH
@@ -227,7 +257,7 @@ int fosa_get_priority_min();
  * priority
  * 
  * Returns 0 if successful, or the following error code:
- *    EINVAL: the specified priority value is not between the 
+ *    FOSA_EINVAL: the specified priority value is not between the 
  *            minimum and the maximum priorities defined in this
  *            FRSH implementation
  * Alternatively, in case of error the implementation is allowed to
@@ -247,7 +277,7 @@ int fosa_thread_attr_set_prio(frsh_thread_attr_t *attr, int prio);
  * Returns 0
  **/
  int fosa_thread_attr_get_prio
-          (const frsh_thread_attr_t *attr, size_t *prio);
+          (const frsh_thread_attr_t *attr, int *prio);
 
 /**
  * fosa_thread_set_prio()
@@ -258,7 +288,7 @@ int fosa_thread_attr_set_prio(frsh_thread_attr_t *attr, int prio);
  * set to the value specified by prio. 
  * 
  * Returns 0 if successful, or the following error code:
- *    EINVAL: the specified priority value is not between the 
+ *    FOSA_EINVAL: the specified priority value is not between the 
  *            minimum and the maximum priorities defined in this
  *            FRSH implementation
  * Alternatively, in case of error the implementation is allowed to
@@ -304,7 +334,7 @@ int fosa_thread_get_prio (frsh_thread_id_t tid, int *prio);
  * which must be of size equal to size
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: the array contains one or more values which are not
+ *     FOSA_EINVAL: the array contains one or more values which are not
  *             between FOSA_SIGNAL_MIN and FOSA_SIGNAL_MAX, or size
  *             is less than 0
  *
@@ -331,10 +361,10 @@ int fosa_set_accepted_signals(frsh_signal_t set[], int size);
  * thread be the one who is waiting for the signal. 
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: the signal specified by signal is not
+ *     FOSA_EINVAL: the signal specified by signal is not
  *              between FOSA_SIGNAL_MIN and FOSA_SIGNAL_MAX
  *
- *     EAGAIN: no resources are available to queue the signal; the
+ *     FOSA_EAGAIN: no resources are available to queue the signal; the
  *             maximum number of queued signals has been reached, or a
  *             systemwide resource limit has been exceeded
  *
@@ -342,11 +372,13 @@ int fosa_set_accepted_signals(frsh_signal_t set[], int size);
  * notify it to the system console and then terminate the FRSH
  * implementation and dependant applications
  **/
- int fosa_signal_queue
+int fosa_signal_queue
        (frsh_signal_t signal, frsh_signal_info_t info,
         frsh_thread_id_t receiver);
 
 
+
+
 /**
  * fosa_signal_wait()
  *
@@ -363,7 +395,7 @@ int fosa_set_accepted_signals(frsh_signal_t set[], int size);
  * is stored in the variable pointed to by info.
  *
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: the array contains one or more values which are not
+ *     FOSA_EINVAL: the array contains one or more values which are not
  *             between FOSA_SIGNAL_MIN and FOSA_SIGNAL_MAX, or size
  *             is less than 0
  *
@@ -385,12 +417,12 @@ int fosa_set_accepted_signals(frsh_signal_t set[], int size);
  * the timespec structure referenced by timeout.
  * 
  * Returns 0 if successful; otherwise it returns an error code:
- *     EINVAL: the array contains one or more values which are not
+ *     FOSA_EINVAL: the array contains one or more values which are not
  *             between FOSA_SIGNAL_MIN and FOSA_SIGNAL_MAX, or size
  *             is less than 0, or timeout is invalid
- *     EAGAIN: The timeout expired
+ *     FOSA_EAGAIN: The timeout expired
  *
- * Alternatively, in case of the EINVAL error the implementation is
+ * Alternatively, in case of the FOSA_EINVAL error the implementation is
  * allowed to notify it to the system console and then terminate the
  * FRSH implementation and dependant applications
  **/