Index: trunk/kernel/kern/thread.h
===================================================================
--- trunk/kernel/kern/thread.h	(revision 23)
+++ trunk/kernel/kern/thread.h	(revision 174)
@@ -1,5 +1,5 @@
 /*
  * thread.h -  Thread and related operations definition.
- * 
+ *
  * Author  Ghassan Almaless (2008,2009,2010,2011,2012)
  *         Alain Greiner (2016)
@@ -46,5 +46,5 @@
  **************************************************************************************/
 
-#define LTID_FROM_TRDID( trdid )   (ltid_t)(trdid & 0x0000FFFF) 
+#define LTID_FROM_TRDID( trdid )   (ltid_t)(trdid & 0x0000FFFF)
 #define CXY_FROM_TRDID( trdid )    (cxy_t)(trdid >> 16)
 #define TRDID( cxy , ltid )        (trdid_t)((cxy << 16) | ltid )
@@ -55,10 +55,10 @@
 
 /***************************************************************************************
- * This opaque structure contains the user defined attributes for an user thread.
+ * This opaque structure contains the user defined attributes for a user thread.
  * It is passed as input argument to the thread_user_create() function.
  * It is set by the user application itself, using the pthread_attr_***() functions.
  * The currently supported attributes are defined below.
  **************************************************************************************/
- 
+
 typedef struct pthread_attr_s
 {
@@ -66,5 +66,5 @@
 	cxy_t       cxy;             /*! target cluster identifier                        */
 	lid_t       lid;             /*! target core index                                */
-} 
+}
 pthread_attr_t;
 
@@ -82,6 +82,6 @@
 
 typedef enum
-{   
-	THREAD_USER    = 0,          /*! user thread (pthread)                            */ 
+{
+	THREAD_USER    = 0,          /*! user thread (pthread)                            */
 	THREAD_RPC     = 1,          /*! kernel thread executing pending RPCs             */
 	THREAD_DEV     = 2,          /*! kernel thread executing I/O device commands      */
@@ -89,5 +89,5 @@
 	THREAD_IDLE    = 4,          /*! kernel idle thread                               */
 	THREAD_TYPES_NR
-} 
+}
 thread_type_t;
 
@@ -111,5 +111,5 @@
  **************************************************************************************/
 
-#define THREAD_BLOCKED_GLOBAL    0x0001  /*! thread desactivated / wait activation    */ 
+#define THREAD_BLOCKED_GLOBAL    0x0001  /*! thread deactivated / wait activation     */
 #define THREAD_BLOCKED_IO        0x0002  /*! thread wait IO operation completion      */
 #define THREAD_BLOCKED_MAPPER    0x0004  /*! thread wait mapper                       */
@@ -150,5 +150,5 @@
  * This structure defines a thread descriptor.
  * It is used for both the user threads and the kernel threads.
- * In a process, an user thread is identified by a unique TRDID (thread identifier),
+ * In a process, a user thread is identified by a unique TRDID (thread identifier),
  * that is returned by the kernel to the user:
  * - The TRDID 16 LSB bits contain the LTID (Local Thread Index).
@@ -156,5 +156,5 @@
  * - The LTID is used to index the th_tbl[] array in the local process descriptor.
  * This TRDID is computed by the process_register_thread() function, when the user
- * thread is registerd in the local copy of the process descriptor.
+ * thread is registered in the local copy of the process descriptor.
  **************************************************************************************/
 
@@ -174,8 +174,8 @@
 	core_t            * core;            /*! pointer to the owner core                */
 	process_t         * process;         /*! pointer on local process descriptor      */
-    xptr_t              parent;          /*! extended pointer on parent thread        */       
+    xptr_t              parent;          /*! extended pointer on parent thread        */
 
     void              * exit_value;      /*! exit_value used in case of join          */
-    
+
 	uint32_t            local_locks;	 /*! number of local locks owned by thread    */
     list_entry_t        locks_root;      /*! root of local locks list                 */
@@ -220,7 +220,7 @@
         mmc_command_t   mmc;             /*! MMC device generic command               */
         dma_command_t   dma;             /*! DMA device generic command               */
-    }  
+    }
     command;
-    
+
 	cxy_t               rpc_client_cxy;  /*! client cluster index (for a RPC thread)  */
 
@@ -230,5 +230,5 @@
 
 	uint32_t            signature;       /*! for kernel stack overflow detection      */
-} 
+}
 thread_t;
 
@@ -248,13 +248,13 @@
 
 /***************************************************************************************
- * This function allocates memory for an user thread descriptor in the local cluster,
+ * This function allocates memory for a user thread descriptor in the local cluster,
  * and initializes it from information contained in the arguments.
- * It is used by the "pthread_create" system call. 
- * The CPU context is initialised from scratch, and the "loadable" field is set.
+ * It is used by the "pthread_create" system call.
+ * The CPU context is initialized from scratch, and the "loadable" field is set.
  * The new thread is attached to the core specified in the <attr> argument.
  * It is registered in the local process descriptor specified by the <pid> argument.
  * The thread descriptor pointer is returned to allow the parent thread to register it
  * in its children list.
- * The THREAD_BLOCKED_GLOBAL bit is set => the thread must be activated to start.   
+ * The THREAD_BLOCKED_GLOBAL bit is set => the thread must be activated to start.
  ***************************************************************************************
  * @ pid          : process identifier.
@@ -262,5 +262,5 @@
  * @ start_args   : pointer on function argument (can be NULL).
  * @ attr         : pointer on pthread attributes descriptor.
- * @ new_thread   : [out] address of buffer for new thread descriptor pointer.  
+ * @ new_thread   : [out] address of buffer for new thread descriptor pointer.
  * @ returns 0 if success / returns ENOMEM if error.
  **************************************************************************************/
@@ -273,14 +273,14 @@
 /***************************************************************************************
  * This function allocates memory for an user thread descriptor in the local cluster,
- * and initialises it from informations contained in the calling thread descriptor.
+ * and initializes it from information contained in the calling thread descriptor.
  * It is used by the fork() system call to create the child process main thread.
- * The new thread is attached to the core with the lowest load. 
+ * The new thread is attached to the core with the lowest load.
  * It is registered in the process descriptor defined by the "process" argument.
  * This new thread inherits its execution context from the calling thread,
  * and the "loadable" field is NOT set.
- * The THREAD_BLOCKED_GLOBAL bit is set, and the thread must be activated to start.   
+ * The THREAD_BLOCKED_GLOBAL bit is set, and the thread must be activated to start.
  ***************************************************************************************
  * @ process      : local pointer on owner process descriptor.
- * @ new_thread   : [out] address of buffer for new thread descriptor pointer.  
+ * @ new_thread   : [out] address of buffer for new thread descriptor pointer.
  * @ returns 0 if success / returns ENOMEM if error.
  **************************************************************************************/
@@ -290,7 +290,7 @@
 /***************************************************************************************
  * This function allocates memory for a kernel thread descriptor in the local cluster,
- * and initialise it from arguments values, calling the thread_kernel_init() function,
+ * and initializes it from arguments values, calling the thread_kernel_init() function,
  * that also allocates and initializes the CPU context.
- * The THREAD_BLOCKED_GLOBAL bit is set, and the thread must be activated to start.   
+ * The THREAD_BLOCKED_GLOBAL bit is set, and the thread must be activated to start.
  ***************************************************************************************
  * @ new_thread   : address of buffer for new thread pointer.
@@ -303,11 +303,11 @@
 error_t thread_kernel_create( thread_t     ** new_thread,
                               thread_type_t   type,
-                              void          * func, 
+                              void          * func,
                               void          * args,
                               lid_t           core_lid );
 
 /***************************************************************************************
- * This function initialises an existing kernel thread descriptor from arguments values.
- * The THREAD_BLOCKED_GLOBAL bit is set, and the thread must be activated to start.   
+ * This function initializes an existing kernel thread descriptor from arguments values.
+ * The THREAD_BLOCKED_GLOBAL bit is set, and the thread must be activated to start.
  ***************************************************************************************
  * @ thread   : pointer on existing thread descriptor.
@@ -320,15 +320,15 @@
 error_t thread_kernel_init( thread_t      * thread,
                             thread_type_t   type,
-                            void          * func, 
+                            void          * func,
                             void          * args,
                             lid_t           core_lid );
 
 /***************************************************************************************
- * This function releases the physical memory allocated for a thread descriptor 
+ * This function releases the physical memory allocated for a thread descriptor
  * in the local cluster. It can be used for both an user and a kernel thread.
- * The physical memory dynamically allocated in the HEAP or MMAP zones by an user 
+ * The physical memory dynamically allocated in the HEAP or MMAP zones by an user
  * thread will be released when the process is killed, and the page table flushed.
  ***************************************************************************************
- * @ thread  : pointer on the thread descriptor to release.  
+ * @ thread  : pointer on the thread descriptor to release.
  **************************************************************************************/
 void thread_destroy( thread_t * thread );
@@ -338,5 +338,5 @@
  * or when no other thread is runnable for a given core.
  *
- * TODO: In the TSAR architecture, it enters an infinite loop, in wich it forces 
+ * TODO: In the TSAR architecture, it enters an infinite loop, in wich it forces
  * the core in sleep (low-power) mode. Any IRQ will force the core to exit this sleep
  * mode, but no ISR is executed.
@@ -346,7 +346,7 @@
 
 /***************************************************************************************
- * This function registers a child thread in the global list of attached 
+ * This function registers a child thread in the global list of attached
  * children threads of a parent thread.
- * It does NOT take a lock, as this function is allways called by the parent thread.
+ * It does NOT take a lock, as this function is always called by the parent thread.
  ***************************************************************************************
  * @ xp_parent : extended pointer on the parent thread descriptor.
@@ -357,6 +357,6 @@
 
 /***************************************************************************************
- * This function removes an user thread from the parent thread global list 
- * of attached children threads. 
+ * This function removes an user thread from the parent thread global list
+ * of attached children threads.
  ***************************************************************************************
  * @ xp_parent : extended pointer on the parent thread descriptor.
@@ -367,5 +367,5 @@
 
 /***************************************************************************************
- * This function atomically set a signal in a thread descriptor.
+ * This function atomically sets a signal in a thread descriptor.
  ***************************************************************************************
  * @ thread    : local pointer on target thread.
@@ -376,5 +376,5 @@
 
 /***************************************************************************************
- * This function reset a signal in a thread descriptor.
+ * This function resets a signal in a thread descriptor.
  ***************************************************************************************
  * @ thread    : local pointer on target thread.
@@ -395,5 +395,5 @@
 
 /***************************************************************************************
- * This function cheks if the calling thread can deschedule.
+ * This function checks if the calling thread can deschedule.
  ***************************************************************************************
  * @ returns true if no locks taken.
@@ -402,5 +402,5 @@
 
 /***************************************************************************************
- * This function checks if the calling thread must be descheduled. 
+ * This function checks if the calling thread must be descheduled.
  ***************************************************************************************
  * @ returns true if no locks taken, and elapsed time.
@@ -410,9 +410,9 @@
 /***************************************************************************************
  * This function can be used by the calling thread to suicide.
- * All locks must be previouly released.
+ * All locks must be previously released.
  * The scenario depends on the attached/detached flag :
- * - if detached, it set the SIG_KILL signal in the "signals" bit_vector, registers
+ * - if detached, it sets the SIG_KILL signal in the "signals" bit_vector, registers
  *   the BLOCKED_EXIT bit in the "blocked" bit_vector, and deschedule.
- * - if attached, it simply set the BLOCKED_EXIT bit in the "blocked" bit vector
+ * - if attached, it simply sets the BLOCKED_EXIT bit in the "blocked" bit vector
  *   and deschedule. The SIG_KILL signal will be set by the parent thread when
  *   executing the pthread_join().
@@ -422,8 +422,8 @@
 error_t thread_exit();
 
-/***************************************************************************************  
+/***************************************************************************************
  * This function registers a blocking cause in the target thread "blocked" bit vector.
  * Warning : this function does not deschedule the calling thread.
- * The descheduling can be forced by a sched_yield(). 
+ * The descheduling can be forced by a sched_yield().
  ***************************************************************************************
  * @ thread   : local pointer on target thread.
@@ -433,10 +433,10 @@
                    uint32_t   cause );
 
-/***************************************************************************************  
- * This function reset the bit identified by the cause argument in the "blocked"
+/***************************************************************************************
+ * This function resets the bit identified by the cause argument in the "blocked"
  * bit vector of a remote thread descriptor.
  * We need an extended pointer, because the client thread of an I/O operation on a
  * given device is not in the same cluster as the associated device descriptor.
- * Warning : this function does not reschedule the remote thread. 
+ * Warning : this function does not reschedule the remote thread.
  * The scheduling can be forced by sending an IPI to the core running the remote thread.
  ***************************************************************************************
@@ -447,5 +447,5 @@
                      uint32_t cause );
 
-/***************************************************************************************  
+/***************************************************************************************
  * This function kills a target thread, identified by its local pointer.
  * It is generally called by the local process_destroy() function.
@@ -460,5 +460,5 @@
 
 /***************************************************************************************
- * This function updates the calling thread user_time counter, and reset the thread
+ * This function updates the calling thread user_time counter, and resets the thread
  * cycles counter.
  * TODO This function is not implemented.
@@ -469,5 +469,5 @@
 
 /**************************************************************************************n
- * This function updates the calling thread kernel_time counter, and reset the thread
+ * This function updates the calling thread kernel_time counter, and resets the thread
  * cycles counter.
  * TODO This function is not implemented.
@@ -478,7 +478,7 @@
 
 /***************************************************************************************
- * This function handle all pending signals for the thread identified by the <thread>
- * argument. It is called each time the core exit the kernel, after handling an
- * interrupt, exception or syscall. 
+ * This function handles all pending signals for the thread identified by the <thread>
+ * argument. It is called each time the core exits the kernel, after handling an
+ * interrupt, exception or syscall.
  * TODO This function is not implemented.
  ***************************************************************************************
@@ -494,5 +494,5 @@
  * @ pid     : process identifier.
  * @ trdid   : thread identifier.
- * @ return the extended pointer if thread found / return XPTR_NULL if not found. 
+ * @ return the extended pointer if thread found / return XPTR_NULL if not found.
  **************************************************************************************/
 xptr_t thread_get_xptr( pid_t    pid,
