sched/signal and related changes to other OS subsystems.

This commit is contained in:
Xiang Xiao
2019-01-27 09:28:59 -06:00
committed by Gregory Nutt
parent d105dc9b5e
commit fb63c0a293
34 changed files with 212 additions and 225 deletions
+2 -1
View File
@@ -43,9 +43,9 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <signal.h>
#include <time.h>
#include <nuttx/signal.h>
#include <nuttx/wqueue.h>
/****************************************************************************
@@ -137,6 +137,7 @@ struct aiocb
* application code should never reference these elements.
*/
struct sigwork_s aio_sigwork; /* Signal work */
volatile ssize_t aio_result; /* Support for aio_error() and aio_return() */
FAR void *aio_priv; /* Used by signal handlers */
};
+2 -1
View File
@@ -45,8 +45,8 @@
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <signal.h>
#include <nuttx/signal.h>
#include <nuttx/fs/ioctl.h>
/****************************************************************************
@@ -144,6 +144,7 @@ struct gpio_operations_s
struct gpio_signal_s
{
struct sigevent gp_event;
struct sigwork_s gp_work;
pid_t gp_pid; /* The task to be signaled */
};
+2 -1
View File
@@ -43,13 +43,13 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <nuttx/signal.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <mqueue.h>
#include <queue.h>
#include <signal.h>
#if CONFIG_MQ_MAXMSGSIZE > 0
@@ -117,6 +117,7 @@ struct mqueue_inode_s
FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */
pid_t ntpid; /* Notification: Receiving Task's PID */
struct sigevent ntevent; /* Notification description */
struct sigwork_s ntwork; /* Notification work */
#endif
};
+47 -1
View File
@@ -41,11 +41,35 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/wqueue.h>
#include <sys/types.h>
#include <stdbool.h>
#include <signal.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef CONFIG_SIG_EVTHREAD
#define sigwork_init(work) memset(work, 0, sizeof(*work));
#else
#define sigwork_init(work) (void)(work)
#endif
/****************************************************************************
* Public Type Definitions
****************************************************************************/
struct sigwork_s
{
#ifdef CONFIG_SIG_EVTHREAD
struct work_s work; /* Work queue structure */
union sigval value; /* Data passed with notification */
sigev_notify_function_t func; /* Notification function */
#endif
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -445,6 +469,7 @@ int nxsig_usleep(useconds_t usec);
* event - The instance of struct sigevent that describes how to signal
* the client.
* code - Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ
* work - The work structure to queue
*
* Returned Value:
* This is an internal OS interface and should not be used by applications.
@@ -453,6 +478,27 @@ int nxsig_usleep(useconds_t usec);
*
****************************************************************************/
int nxsig_notification(pid_t pid, FAR struct sigevent *event, int code);
int nxsig_notification(pid_t pid, FAR struct sigevent *event,
int code, FAR struct sigwork_s *work);
/****************************************************************************
* Name: nxsig_cancel_notification
*
* Description:
* Cancel the notification if it doesn't send yet.
*
* Input Parameters:
* work - The work structure to cancel
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_SIG_EVTHREAD
void nxsig_cancel_notification(FAR struct sigwork_s *work);
#else
#define nxsig_cancel_notification(work) (void)(work)
#endif
#endif /* __INCLUDE_NUTTX_SIGNAL_H */