Move cancellation point definitions to their own header file.
This commit is contained in:
parent
bc3ca25cc7
commit
b52e4e5ecd
|
@ -43,7 +43,7 @@
|
|||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
/****************************************************************************
|
||||
* include/nuttx/cancelpt.h
|
||||
* Definitions related to cancellation points
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_CANCELPT_H
|
||||
#define __INCLUDE_NUTTX_CANCELPT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Cancellation Points.
|
||||
*
|
||||
* Cancellation points shall occur when a thread is executing the following
|
||||
* functions:
|
||||
*
|
||||
* accept() mq_timedsend() putpmsg() sigtimedwait()
|
||||
* aio_suspend() msgrcv() pwrite() sigwait()
|
||||
* clock_nanosleep() msgsnd() read() sigwaitinfo()
|
||||
* close() msync() readv() sleep()
|
||||
* connect() nanosleep() recv() system()
|
||||
* creat() open() recvfrom() tcdrain()
|
||||
* fcntl() pause() recvmsg() usleep()
|
||||
* fdatasync() poll() select() wait()
|
||||
* fsync() pread() sem_timedwait() waitid()
|
||||
* getmsg() pselect() sem_wait() waitpid()
|
||||
* getpmsg() pthread_cond_timedwait() send() write()
|
||||
* lockf() pthread_cond_wait() sendmsg() writev()
|
||||
* mq_receive() pthread_join() sendto()
|
||||
* mq_send() pthread_testcancel() sigpause()
|
||||
* mq_timedreceive() putmsg() sigsuspend()
|
||||
*
|
||||
* Each of the above function must call enter_cancellation_point() on entry
|
||||
* in order to establish the cancellation point and leave_cancellation_point()
|
||||
* on exit. These functions are described below.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: enter_cancellation_point
|
||||
*
|
||||
* Description:
|
||||
* Called at the beginning of the cancellation point to establish the
|
||||
* cancellation point. This function does the following:
|
||||
*
|
||||
* 1. If deferred cancellation does not apply to this thread, nothing is
|
||||
* done, otherwise, it
|
||||
* 2. Sets state information in the caller's TCB and increments a nesting
|
||||
* count.
|
||||
* 3. If this is the outermost nesting level, it checks if there is a
|
||||
* pending cancellation and, if so, calls either exit() or
|
||||
* pthread_exit(), depending upon the type of the thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value
|
||||
* true is returned if a cancellation is pending but cannot be performed
|
||||
* now due to the nesting level.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CANCELLATION_POINTS
|
||||
bool enter_cancellation_point(void);
|
||||
#else
|
||||
# define enter_cancellation_point() false
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: leave_cancellation_point
|
||||
*
|
||||
* Description:
|
||||
* Called at the end of the cancellation point. This function does the
|
||||
* following:
|
||||
*
|
||||
* 1. If deferred cancellation does not apply to this thread, nothing is
|
||||
* done, otherwise, it
|
||||
* 2. Clears state information in the caller's TCB and decrements a
|
||||
* nesting count.
|
||||
* 3. If this is the outermost nesting level, it checks if there is a
|
||||
* pending cancellation and, if so, calls either exit() or
|
||||
* pthread_exit(), depending upon the type of the thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CANCELLATION_POINTS
|
||||
void leave_cancellation_point(void);
|
||||
#else
|
||||
# define leave_cancellation_point()
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_CANCELPT_H */
|
|
@ -43,7 +43,6 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
|
@ -129,93 +128,6 @@ EXTERN const pthread_attr_t g_default_pthread_attr;
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Cancellation Points.
|
||||
*
|
||||
* Cancellation points shall occur when a thread is executing the following
|
||||
* functions:
|
||||
*
|
||||
* accept() mq_timedsend() putpmsg() sigtimedwait()
|
||||
* aio_suspend() msgrcv() pwrite() sigwait()
|
||||
* clock_nanosleep() msgsnd() read() sigwaitinfo()
|
||||
* close() msync() readv() sleep()
|
||||
* connect() nanosleep() recv() system()
|
||||
* creat() open() recvfrom() tcdrain()
|
||||
* fcntl() pause() recvmsg() usleep()
|
||||
* fdatasync() poll() select() wait()
|
||||
* fsync() pread() sem_timedwait() waitid()
|
||||
* getmsg() pselect() sem_wait() waitpid()
|
||||
* getpmsg() pthread_cond_timedwait() send() write()
|
||||
* lockf() pthread_cond_wait() sendmsg() writev()
|
||||
* mq_receive() pthread_join() sendto()
|
||||
* mq_send() pthread_testcancel() sigpause()
|
||||
* mq_timedreceive() putmsg() sigsuspend()
|
||||
*
|
||||
* Each of the above function must call enter_cancellation_point() on entry
|
||||
* in order to establish the cancellation point and leave_cancellation_point()
|
||||
* on exit. These functions are described below.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: enter_cancellation_point
|
||||
*
|
||||
* Description:
|
||||
* Called at the beginning of the cancellation point to establish the
|
||||
* cancellation point. This function does the following:
|
||||
*
|
||||
* 1. If deferred cancellation does not apply to this thread, nothing is
|
||||
* done, otherwise, it
|
||||
* 2. Sets state information in the caller's TCB and increments a nesting
|
||||
* count.
|
||||
* 3. If this is the outermost nesting level, it checks if there is a
|
||||
* pending cancellation and, if so, calls either exit() or
|
||||
* pthread_exit(), depending upon the type of the thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value
|
||||
* true is returned if a cancellation is pending but cannot be performed
|
||||
* now due to the nesting level.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CANCELLATION_POINTS
|
||||
bool enter_cancellation_point(void);
|
||||
#else
|
||||
# define enter_cancellation_point() false
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: leave_cancellation_point
|
||||
*
|
||||
* Description:
|
||||
* Called at the end of the cancellation point. This function does the
|
||||
* following:
|
||||
*
|
||||
* 1. If deferred cancellation does not apply to this thread, nothing is
|
||||
* done, otherwise, it
|
||||
* 2. Clears state information in the caller's TCB and decrements a
|
||||
* nesting count.
|
||||
* 3. If this is the outermost nesting level, it checks if there is a
|
||||
* pending cancellation and, if so, calls either exit() or
|
||||
* pthread_exit(), depending upon the type of the thread.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CANCELLATION_POINTS
|
||||
void leave_cancellation_point(void);
|
||||
#else
|
||||
# define leave_cancellation_point()
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "tcp/tcp.h"
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/udp.h>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/iob.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "tcp/tcp.h"
|
||||
#include "udp/udp.h"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
#include <nuttx/net/net.h>
|
||||
|
||||
#include "udp/udp.h"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "mqueue/mqueue.h"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "mqueue/mqueue.h"
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "mqueue/mqueue.h"
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "clock/clock.h"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "clock/clock.h"
|
||||
#include "sched/sched.h"
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "pthread/pthread.h"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "pthread/pthread.h"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "group/group.h"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/pthread.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "group/group.h"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "group/group.h"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "clock/clock.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "semaphore/semaphore.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "clock/clock.h"
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "signal/signal.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include <signal.h>
|
||||
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/pthread.h>
|
||||
#include <nuttx/cancelpt.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "semaphore/semaphore.h"
|
||||
|
|
Loading…
Reference in New Issue