summaryrefslogtreecommitdiff
path: root/nuttx/sched/sig_mqnotempty.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-05 19:50:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-05 19:50:37 +0000
commit0d9fb476ea6f347c48a3ac8c2d98251467421203 (patch)
treee98b731e1ff4298ed906fde23198fb4d9a9d61a9 /nuttx/sched/sig_mqnotempty.c
parent70121d6ca8fd0e48f35b3ccb52e3b960e64df6c2 (diff)
downloadpx4-nuttx-0d9fb476ea6f347c48a3ac8c2d98251467421203.tar.gz
px4-nuttx-0d9fb476ea6f347c48a3ac8c2d98251467421203.tar.bz2
px4-nuttx-0d9fb476ea6f347c48a3ac8c2d98251467421203.zip
Moving pending signals to task group; Logic to recover some MQ resources on pthread_cacancel or task_delete; Now obeys rules for delivering signals to a process with threads
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5613 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sig_mqnotempty.c')
-rw-r--r--nuttx/sched/sig_mqnotempty.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/nuttx/sched/sig_mqnotempty.c b/nuttx/sched/sig_mqnotempty.c
index 6eb434813..54ea2f9aa 100644
--- a/nuttx/sched/sig_mqnotempty.c
+++ b/nuttx/sched/sig_mqnotempty.c
@@ -42,6 +42,7 @@
#include <signal.h>
#include <sched.h>
+#include <errno.h>
#include <debug.h>
#include "os_internal.h"
@@ -83,30 +84,30 @@
****************************************************************************/
#ifdef CONFIG_CAN_PASS_STRUCTS
-int sig_mqnotempty (int pid, int signo, union sigval value)
+int sig_mqnotempty(int pid, int signo, union sigval value)
#else
-int sig_mqnotempty (int pid, int signo, void *sival_ptr)
+int sig_mqnotempty(int pid, int signo, void *sival_ptr)
#endif
{
#ifdef CONFIG_SCHED_HAVE_PARENT
FAR struct tcb_s *rtcb = (FAR struct tcb_s *)g_readytorun.head;
#endif
- FAR struct tcb_s *stcb;
siginfo_t info;
- int ret = ERROR;
-
- sched_lock();
-
- /* Get the TCB of the receiving task */
-
- stcb = sched_gettcb(pid);
+ int ret;
#ifdef CONFIG_CAN_PASS_STRUCTS
- sdbg("TCB=%p signo=%d value=%d\n", stcb, signo, value.sival_int);
+ sdbg("pid=%p signo=%d value=%d\n", pid, signo, value.sival_int);
#else
- sdbg("TCB=%p signo=%d sival_ptr=%p\n", stcb, signo, sival_ptr);
+ sdbg("pid=%p signo=%d sival_ptr=%p\n", pid, signo, sival_ptr);
#endif
+ /* Verify that we can perform the signalling operation */
+
+ if (GOOD_SIGNO(signo))
+ {
+ return -EINVAL;
+ }
+
/* Create the siginfo structure */
info.si_signo = signo;
@@ -121,15 +122,11 @@ int sig_mqnotempty (int pid, int signo, void *sival_ptr)
info.si_status = OK;
#endif
- /* Verify that we can perform the signalling operation */
-
- if ((stcb) && (GOOD_SIGNO(signo)))
- {
- /* Process the receipt of the signal */
-
- ret = sig_received(stcb, &info);
- }
+ /* Process the receipt of the signal */
+ sched_lock();
+ ret = sig_dispatch(pid, &info);
sched_unlock();
+
return ret;
}