sched/task/task_exithook.c: Update some commits. include/nuttx/sched.h: Fix some complaints from nxstyle.

This commit is contained in:
Gregory Nutt 2019-08-02 08:49:26 -06:00
parent e7fdbd8c81
commit 4c800ca372
2 changed files with 27 additions and 7 deletions

View File

@ -63,7 +63,9 @@
/******************************************************************************** /********************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
********************************************************************************/ ********************************************************************************/
/* Configuration ****************************************************************/ /* Configuration ****************************************************************/
/* Task groups currently only supported for retention of child status */ /* Task groups currently only supported for retention of child status */
#undef HAVE_GROUP_MEMBERS #undef HAVE_GROUP_MEMBERS
@ -89,6 +91,7 @@
#endif #endif
/* Task Management Definitions **************************************************/ /* Task Management Definitions **************************************************/
/* Special task IDS. Any negative PID is invalid. */ /* Special task IDS. Any negative PID is invalid. */
#define NULL_TASK_PROCESS_ID (pid_t)0 #define NULL_TASK_PROCESS_ID (pid_t)0
@ -188,6 +191,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
/* General Task Management Types ************************************************/ /* General Task Management Types ************************************************/
/* This is the type of the task_state field of the TCB. NOTE: the order and /* This is the type of the task_state field of the TCB. NOTE: the order and
* content of this enumeration is critical since there are some OS tables indexed * content of this enumeration is critical since there are some OS tables indexed
* by these values. The range of values is assumed to fit into a uint8_t in * by these values. The range of values is assumed to fit into a uint8_t in
@ -313,6 +317,7 @@ struct sporadic_s
#endif /* CONFIG_SCHED_SPORADIC */ #endif /* CONFIG_SCHED_SPORADIC */
/* struct child_status_s *********************************************************/ /* struct child_status_s *********************************************************/
/* This structure is used to maintain information about child tasks. pthreads /* This structure is used to maintain information about child tasks. pthreads
* work differently, they have join information. This is only for child tasks. * work differently, they have join information. This is only for child tasks.
*/ */
@ -329,17 +334,19 @@ struct child_status_s
#endif #endif
/* struct pthread_cleanup_s ******************************************************/ /* struct pthread_cleanup_s ******************************************************/
/* This structure describes one element of the pthread cleanup stack */ /* This structure describes one element of the pthread cleanup stack */
#ifdef CONFIG_PTHREAD_CLEANUP #ifdef CONFIG_PTHREAD_CLEANUP
struct pthread_cleanup_s struct pthread_cleanup_s
{ {
pthread_cleanup_t pc_cleaner; /* Cleanup callback address */ pthread_cleanup_t pc_cleaner; /* Cleanup callback address */
FAR void *pc_arg; /* Argument that accompanies the callback */ FAR void *pc_arg; /* Argument that accompanies the callback */
}; };
#endif #endif
/* type pthread_keyset_t *********************************************************/ /* type pthread_keyset_t *********************************************************/
/* Smallest addressable type that can hold the entire configured number of keys */ /* Smallest addressable type that can hold the entire configured number of keys */
#if defined(CONFIG_NPTHREAD_KEYS) && CONFIG_NPTHREAD_KEYS > 0 #if defined(CONFIG_NPTHREAD_KEYS) && CONFIG_NPTHREAD_KEYS > 0
@ -355,6 +362,7 @@ struct pthread_cleanup_s
#endif #endif
/* struct dspace_s ***************************************************************/ /* struct dspace_s ***************************************************************/
/* This structure describes a reference counted D-Space region. This must be a /* This structure describes a reference counted D-Space region. This must be a
* separately allocated "break-away" structure that can be owned by a task and * separately allocated "break-away" structure that can be owned by a task and
* any pthreads created by the task. * any pthreads created by the task.
@ -381,6 +389,7 @@ struct dspace_s
#endif #endif
/* struct task_group_s ***********************************************************/ /* struct task_group_s ***********************************************************/
/* All threads created by pthread_create belong in the same task group (along with /* All threads created by pthread_create belong in the same task group (along with
* the thread of the original task). struct task_group_s is a shared structure * the thread of the original task). struct task_group_s is a shared structure
* referenced by the TCB of each thread that is a member of the task group. * referenced by the TCB of each thread that is a member of the task group.
@ -481,6 +490,7 @@ struct task_group_s
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) #if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)
/* waitpid support ************************************************************/ /* waitpid support ************************************************************/
/* Simple mechanism used only when there is no support for SIGCHLD */ /* Simple mechanism used only when there is no support for SIGCHLD */
uint8_t tg_nwaiters; /* Number of waiters */ uint8_t tg_nwaiters; /* Number of waiters */
@ -491,6 +501,7 @@ struct task_group_s
#ifndef CONFIG_DISABLE_PTHREAD #ifndef CONFIG_DISABLE_PTHREAD
/* Pthreads *******************************************************************/ /* Pthreads *******************************************************************/
/* Pthread join Info: */ /* Pthread join Info: */
sem_t tg_joinsem; /* Mutually exclusive access to join data */ sem_t tg_joinsem; /* Mutually exclusive access to join data */
FAR struct join_s *tg_joinhead; /* Head of a list of join data */ FAR struct join_s *tg_joinhead; /* Head of a list of join data */
@ -516,6 +527,7 @@ struct task_group_s
#endif #endif
/* PIC data space and address environments ************************************/ /* PIC data space and address environments ************************************/
/* Logically the PIC data space belongs here (see struct dspace_s). The /* Logically the PIC data space belongs here (see struct dspace_s). The
* current logic needs review: There are differences in the away that the * current logic needs review: There are differences in the away that the
* life of the PIC data is managed. * life of the PIC data is managed.
@ -527,6 +539,7 @@ struct task_group_s
#if CONFIG_NFILE_STREAMS > 0 #if CONFIG_NFILE_STREAMS > 0
/* FILE streams ***************************************************************/ /* FILE streams ***************************************************************/
/* In a flat, single-heap build. The stream list is allocated with this /* In a flat, single-heap build. The stream list is allocated with this
* structure. But kernel mode with a kernel allocator, it must be separately * structure. But kernel mode with a kernel allocator, it must be separately
* allocated using a user-space allocator. * allocated using a user-space allocator.
@ -566,6 +579,7 @@ struct task_group_s
}; };
/* struct tcb_s ******************************************************************/ /* struct tcb_s ******************************************************************/
/* This is the common part of the task control block (TCB). The TCB is the heart /* This is the common part of the task control block (TCB). The TCB is the heart
* of the NuttX task-control logic. Each task or thread is represented by a TCB * of the NuttX task-control logic. Each task or thread is represented by a TCB
* that includes these common definitions. * that includes these common definitions.
@ -681,11 +695,12 @@ struct tcb_s
struct xcptcontext xcp; /* Interrupt register save area */ struct xcptcontext xcp; /* Interrupt register save area */
#if CONFIG_TASK_NAME_SIZE > 0 #if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE+1]; /* Task name (with NUL terminator) */ char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NUL terminator) */
#endif #endif
}; };
/* struct task_tcb_s *************************************************************/ /* struct task_tcb_s *************************************************************/
/* This is the particular form of the task control block (TCB) structure used by /* This is the particular form of the task control block (TCB) structure used by
* tasks (and kernel threads). There are two TCB forms: one for pthreads and * tasks (and kernel threads). There are two TCB forms: one for pthreads and
* one for tasks. Both share the common TCB fields (which must appear at the * one for tasks. Both share the common TCB fields (which must appear at the
@ -714,6 +729,7 @@ struct task_tcb_s
}; };
/* struct pthread_tcb_s **********************************************************/ /* struct pthread_tcb_s **********************************************************/
/* This is the particular form of the task control block (TCB) structure used by /* This is the particular form of the task control block (TCB) structure used by
* pthreads. There are two TCB forms: one for pthreads and one for tasks. Both * pthreads. There are two TCB forms: one for pthreads and one for tasks. Both
* share the common TCB fields (which must appear at the top of the structure) * share the common TCB fields (which must appear at the top of the structure)
@ -791,6 +807,7 @@ EXTERN uint32_t g_crit_max[1];
********************************************************************************/ ********************************************************************************/
/* TCB helpers ******************************************************************/ /* TCB helpers ******************************************************************/
/* sched_self() returns the TCB of the currently running task (i.e., the /* sched_self() returns the TCB of the currently running task (i.e., the
* caller) * caller)
*/ */
@ -809,6 +826,7 @@ void sched_foreach(sched_foreach_t handler, FAR void *arg);
FAR struct tcb_s *sched_gettcb(pid_t pid); FAR struct tcb_s *sched_gettcb(pid_t pid);
/* File system helpers **********************************************************/ /* File system helpers **********************************************************/
/* These functions all extract lists from the group structure assocated with the /* These functions all extract lists from the group structure assocated with the
* currently executing task. * currently executing task.
*/ */

View File

@ -459,9 +459,7 @@ static inline void nxtask_signalparent(FAR struct tcb_s *ctcb, int status)
sched_lock(); sched_lock();
/* Get the TCB of the receiving, parent task. We do this early to /* Get the TCB of the receiving, parent task. We do this early to
* handle multiple calls to nxtask_signalparent. ctcb->group->tg_ppid is * handle multiple calls to nxtask_signalparent.
* set to an invalid value below and the following call will fail if we
* are called again.
*/ */
ptcb = sched_gettcb(ctcb->group->tg_ppid); ptcb = sched_gettcb(ctcb->group->tg_ppid);
@ -473,7 +471,11 @@ static inline void nxtask_signalparent(FAR struct tcb_s *ctcb, int status)
return; return;
} }
/* Send SIGCHLD to all members of the parent's task group */ /* Send SIGCHLD to all members of the parent's task group. NOTE that the
* SIGCHLD signal is only sent once either (1) if this is the final thread
* of the task group that is exiting (HAVE_GROUP_MEMBERS) or (2) if the
* main thread of the group is exiting (!HAVE_GROUP_MEMBERS).
*/
nxtask_sigchild(ptcb, ctcb, status); nxtask_sigchild(ptcb, ctcb, status);
sched_unlock(); sched_unlock();