#include "fosa_types.h"
+
+FOSA_CPP_BEGIN_DECLS
+
+
/**
* @defgroup threadandsignals Thread and Signals
* @ingroup fosa
*
- * This module defines the functions that manipulate frsh_threads and
- * frsh_signals inside FRSH implementation.
+ * This module defines the functions that manipulate fosa_threads and
+ * fosa_signals inside FRSH implementation.
*
* Applications can refer to FRSH threads but they cannot create them
* directly, instead they must use frsh_thread_create*() which in turn
* use fosa_thread_create().
*
* For signals, we assume that the OS provides a direct mapping
- * for frsh_signal_t and frsh_signal_info_t in the native interface.
+ * for fosa_signal_t and fosa_signal_info_t in the native interface.
*
* @{
**/
* Compare two thread identifiers to determine if they refer to the
* same thread
**/
-bool fosa_thread_equal(frsh_thread_id_t t1, frsh_thread_id_t t2);
+bool fosa_thread_equal(fosa_thread_id_t t1, fosa_thread_id_t t2);
/**
*
* Return the thread id of the calling thread
**/
-frsh_thread_id_t fosa_thread_self();
+fosa_thread_id_t fosa_thread_self();
+
+
+/*************************
+ * Thread attributes
+ *************************/
+
+/**
+ * fosa_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 fosa_thread_attr_init(fosa_thread_attr_t *attr);
+
+
+/**
+ * fosa_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 fosa_thread_attr_destroy(fosa_thread_attr_t *attr);
+
+
+/**
+ * fosa_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 fosa_thread_attr_set_stacksize(fosa_thread_attr_t *attr,
+ size_t stacksize);
+
+/**
+ * fosa_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 fosa_thread_attr_get_stacksize(const fosa_thread_attr_t *attr,
+ size_t *stacksize);
/*************************
*
**/
int fosa_thread_create
- (frsh_thread_id_t *tid, const frsh_thread_attr_t *attr,
- frsh_thread_code_t code, void * arg);
+ (fosa_thread_id_t *tid, const fosa_thread_attr_t *attr,
+ fosa_thread_code_t code, void * arg);
/**
* 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.
+ * one for us. The thread specific data of all the threads is set to
+ * the value NULL until changed to a different value via
+ * fosa_thread_set_specific_data().
*
* @return 0 if successful \n
* FOSA_EINVAL If we already have reached the FOSA_MAX_KEYS limit.
*
* Destroy a key
*
- * This destroys the key and isables its use in the system
+ * This destroys the key and disables its use in the system
*
* @return 0 if successful \n
* FOSA_EINVAL The key is not initialised or is not in FOSA key range.
* implementation and dependant applications
**/
int fosa_thread_set_specific_data
- (int key, frsh_thread_id_t tid, const void * value);
+ (int key, fosa_thread_id_t tid, const void * value);
/**
* fosa_thread_get_specific_data()
* notify it to the system console and then terminate the FRSH
* implementation and dependant applications
**/
-int fosa_thread_get_specific_data(int key, frsh_thread_id_t tid,
+int fosa_thread_get_specific_data(int key, fosa_thread_id_t tid,
void ** value);
* notify it to the system console and then terminate the FRSH
* implementation and dependant applications
**/
-int fosa_thread_attr_set_prio(frsh_thread_attr_t *attr, int prio);
+int fosa_thread_attr_set_prio(fosa_thread_attr_t *attr, int prio);
/**
* fosa_thread_attr_get_prio()
* Returns 0
**/
int fosa_thread_attr_get_prio
- (const frsh_thread_attr_t *attr, int *prio);
+ (const fosa_thread_attr_t *attr, int *prio);
/**
* fosa_thread_set_prio()
* notify it to the system console and then terminate the FRSH
* implementation and dependant applications
**/
-int fosa_thread_set_prio(frsh_thread_id_t tid, int prio);
+int fosa_thread_set_prio(fosa_thread_id_t tid, int prio);
/**
* fosa_thread_get_prio()
*
* Returns 0
**/
-int fosa_thread_get_prio (frsh_thread_id_t tid, int *prio);
+int fosa_thread_get_prio (fosa_thread_id_t tid, int *prio);
* synchronously wait. Signals carry an associated piece of
* information (an integer or a pointer) and are queued until they are
* accepted. Signals are identified by an integer signal number (of
- * the type frsh_signal_t) in the range FOSA_SIGNAL_MIN,
+ * the type fosa_signal_t) in the range FOSA_SIGNAL_MIN,
* FOSA_SIGNAL_MAX. This range is required to have at least <tbd>
* values.
*******************************************************************/
* notify it to the system console and then terminate the FRSH
* implementation and dependant applications
**/
-int fosa_set_accepted_signals(frsh_signal_t set[], int size);
+int fosa_set_accepted_signals(fosa_signal_t set[], int size);
/**
* fosa_signal_queue()
* implementation and dependant applications
**/
int fosa_signal_queue
- (frsh_signal_t signal, frsh_signal_info_t info,
- frsh_thread_id_t receiver);
+ (fosa_signal_t signal, fosa_signal_info_t info,
+ fosa_thread_id_t receiver);
* implementation and dependant applications
**/
int fosa_signal_wait
- (frsh_signal_t set[], int size, frsh_signal_t *signal_received,
- frsh_signal_info_t *info);
+ (fosa_signal_t set[], int size, fosa_signal_t *signal_received,
+ fosa_signal_info_t *info);
/**
* fosa_signal_timedwait()
* FRSH implementation and dependant applications
**/
int fosa_signal_timedwait
- (frsh_signal_t set[], int size, frsh_signal_t *signal_received,
- frsh_signal_info_t *info, const struct timespec *timeout);
+ (fosa_signal_t set[], int size, fosa_signal_t *signal_received,
+ fosa_signal_info_t *info, const struct timespec *timeout);
/*}*/
+FOSA_CPP_END_DECLS
#endif /* !FOSA_THREAD_AND_SIGNALS_H_ */