sim: fix signal deliver calling error on sim platform

since the signal deliver handler should be called in signal owner task.

Change-Id: Ic55c08d1a880069864eddda8dab945ce677792d7
This commit is contained in:
mage1 2021-03-16 17:27:26 +08:00 committed by Xiang Xiao
parent 01cde40bdc
commit 5340fde427
5 changed files with 60 additions and 60 deletions

View File

@ -134,18 +134,6 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
rtcb = this_task();
sinfo("New Active Task TCB=%p\n", rtcb);
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
/* Reset scheduler parameters */
nxsched_resume_scheduler(rtcb);
@ -154,5 +142,20 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
up_longjmp(rtcb->xcp.regs, 1);
}
else
{
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
rtcb = this_task();
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
}
}
}

View File

@ -92,18 +92,6 @@ void up_exit(int status)
nxsched_resume_scheduler(tcb);
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded, interrupt
* driven environment.
*/
if (tcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", tcb);
((sig_deliver_t)tcb->xcp.sigdeliver)(tcb);
tcb->xcp.sigdeliver = NULL;
}
/* Then switch contexts */
up_longjmp(tcb->xcp.regs, 1);

View File

@ -103,18 +103,6 @@ void up_release_pending(void)
rtcb = this_task();
sinfo("New Active Task TCB=%p\n", rtcb);
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
@ -123,5 +111,20 @@ void up_release_pending(void)
up_longjmp(rtcb->xcp.regs, 1);
}
else
{
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
rtcb = this_task();
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
}
}
}

View File

@ -158,18 +158,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
rtcb = this_task();
sinfo("New Active Task TCB=%p\n", rtcb);
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
@ -178,6 +166,21 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
up_longjmp(rtcb->xcp.regs, 1);
}
else
{
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
rtcb = this_task();
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
}
}
}
}

View File

@ -136,18 +136,6 @@ void up_unblock_task(FAR struct tcb_s *tcb)
rtcb = this_task();
sinfo("New Active Task TCB=%p\n", rtcb);
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
@ -156,5 +144,20 @@ void up_unblock_task(FAR struct tcb_s *tcb)
up_longjmp(rtcb->xcp.regs, 1);
}
else
{
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
rtcb = this_task();
if (rtcb->xcp.sigdeliver)
{
sinfo("Delivering signals TCB=%p\n", rtcb);
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
rtcb->xcp.sigdeliver = NULL;
}
}
}
}