mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
Fix a *critical* bug in the task exit logic. Implements SIGCHILD
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5513 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -202,6 +202,9 @@ struct _TCB
|
||||
/* Task Management Fields *****************************************************/
|
||||
|
||||
pid_t pid; /* This is the ID of the thread */
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
pid_t parent; /* This is the ID of the parent thread */
|
||||
#endif
|
||||
start_t start; /* Thread start function */
|
||||
entry_t entry; /* Entry Point into the thread */
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
* CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker
|
||||
* thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
|
||||
* CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up
|
||||
* the worker thread. Default: 4
|
||||
* the worker thread. Default: 17
|
||||
*
|
||||
* CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single
|
||||
* work queue is created by default. If CONFIG_SCHED_LPWORK is also defined
|
||||
|
||||
+45
-23
@@ -66,44 +66,56 @@
|
||||
|
||||
/* A few of the real time signals are used within the OS. They have
|
||||
* default values that can be overridden from the configuration file. The
|
||||
* rest are all user signals:
|
||||
* rest are all user signals.
|
||||
*
|
||||
* These are semi-standard signal definitions:
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SIG_SIGUSR1
|
||||
#define SIGUSR1 0 /* User signal 1 */
|
||||
# define SIGUSR1 1 /* User signal 1 */
|
||||
#else
|
||||
#define SIGUSR1 CONFIG_SIG_SIGUSR1
|
||||
# define SIGUSR1 CONFIG_SIG_SIGUSR1
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SIG_SIGUSR2
|
||||
#define SIGUSR2 1 /* User signal 2 */
|
||||
# define SIGUSR2 2 /* User signal 2 */
|
||||
#else
|
||||
#define SIGUSR2 CONFIG_SIG_SIGUSR2
|
||||
# define SIGUSR2 CONFIG_SIG_SIGUSR2
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SIG_SIGALARM
|
||||
#define SIGALRM 2 /* Default signal used with POSIX timers (used only */
|
||||
# define SIGALRM 3 /* Default signal used with POSIX timers (used only */
|
||||
/* no other signal is provided) */
|
||||
#else
|
||||
#define SIGALRM CONFIG_SIG_SIGALARM
|
||||
# define SIGALRM CONFIG_SIG_SIGALARM
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_PTHREAD
|
||||
#ifndef CONFIG_SIG_SIGCONDTIMEDOUT
|
||||
#define SIGCONDTIMEDOUT 3 /* Used in the implementation of pthread_cond_timedwait */
|
||||
#else
|
||||
#define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
# ifndef CONFIG_SIG_SIGCHLD
|
||||
# define SIGCHLD 4 /* Used by child threads to signal parent thread */
|
||||
# else
|
||||
# define SIGCHLD CONFIG_SIG_SIGCHLD
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following are non-standard signal definitions */
|
||||
|
||||
#ifndef CONFIG_DISABLE_PTHREAD
|
||||
# ifndef CONFIG_SIG_SIGCONDTIMEDOUT
|
||||
# define SIGCONDTIMEDOUT 16 /* Used in the implementation of pthread_cond_timedwait */
|
||||
# else
|
||||
# define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* SIGWORK is used to wake up various internal, NuttX worker thread */
|
||||
|
||||
#if defined(CONFIG_SCHED_WORKQUEUE) || defined(CONFIG_PAGING)
|
||||
#ifndef CONFIG_SIG_SIGWORK
|
||||
#define SIGWORK 4 /* Used to wake up the work queue */
|
||||
#else
|
||||
#define SIGWORK CONFIG_SIG_SIGWORK
|
||||
#endif
|
||||
# ifndef CONFIG_SIG_SIGWORK
|
||||
# define SIGWORK 17 /* Used to wake up the work queue */
|
||||
# else
|
||||
# define SIGWORK CONFIG_SIG_SIGWORK
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* sigprocmask() "how" definitions. Only one of the following can be specified: */
|
||||
@@ -122,12 +134,18 @@
|
||||
|
||||
/* These are the possible values of the signfo si_code field */
|
||||
|
||||
#define SI_USER 0 /* Signal sent from kill, raise, or abort */
|
||||
#define SI_QUEUE 1 /* Signal sent from sigqueue */
|
||||
#define SI_TIMER 2 /* Signal is result of timer expiration */
|
||||
#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */
|
||||
#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */
|
||||
/* empty message queue */
|
||||
#define SI_USER 0 /* Signal sent from kill, raise, or abort */
|
||||
#define SI_QUEUE 1 /* Signal sent from sigqueue */
|
||||
#define SI_TIMER 2 /* Signal is result of timer expiration */
|
||||
#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */
|
||||
#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */
|
||||
/* empty message queue */
|
||||
#define CLD_EXITED 5 /* Child has exited (SIGCHLD only) */
|
||||
#define CLD_KILLED 6 /* Child was killed (SIGCHLD only) */
|
||||
#define CLD_DUMPED 7 /* Child terminated abnormally (SIGCHLD only) */
|
||||
#define CLD_TRAPPED 8 /* Traced child has trapped (SIGCHLD only) */
|
||||
#define CLD_STOPPED 9 /* Child has stopped (SIGCHLD only) */
|
||||
#define CLD_CONTINUED 10 /* Stopped child had continued (SIGCHLD only) */
|
||||
|
||||
/* Values for the sigev_notify field of struct sigevent */
|
||||
|
||||
@@ -175,6 +193,10 @@ struct siginfo
|
||||
uint8_t si_signo; /* Identifies signal */
|
||||
uint8_t si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */
|
||||
union sigval si_value; /* Data passed with signal */
|
||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||
pid_t si_pid; /* Sending task ID */
|
||||
int si_status; /* Exit value or signal (SIGCHLD only). */
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct siginfo siginfo_t;
|
||||
|
||||
Reference in New Issue
Block a user