5151 * Pre-processor Definitions
5252 ****************************************************************************/
5353
54- /* These are special values of si_signo that mean that either the wait was
55- * awakened with a timeout, or the wait was canceled... not the receipt of a
56- * signal.
57- */
58-
59- #define SIG_CANCEL_TIMEOUT 0xfe
60- #define SIG_WAIT_TIMEOUT 0xff
61-
6254/****************************************************************************
6355 * Private Functions
6456 ****************************************************************************/
@@ -93,32 +85,7 @@ static void nxsig_timeout(wdparm_t arg)
9385
9486 if (wtcb -> task_state == TSTATE_WAIT_SIG )
9587 {
96- FAR struct tcb_s * rtcb = this_task ();
97-
98- if (wtcb -> sigunbinfo != NULL )
99- {
100- wtcb -> sigunbinfo -> si_signo = SIG_WAIT_TIMEOUT ;
101- wtcb -> sigunbinfo -> si_code = SI_TIMER ;
102- wtcb -> sigunbinfo -> si_errno = ETIMEDOUT ;
103- wtcb -> sigunbinfo -> si_value .sival_int = 0 ;
104- #ifdef CONFIG_SCHED_HAVE_PARENT
105- wtcb -> sigunbinfo -> si_pid = 0 ; /* Not applicable */
106- wtcb -> sigunbinfo -> si_status = OK ;
107- #endif
108- }
109-
110- /* Remove the task from waiting list */
111-
112- dq_rem ((FAR dq_entry_t * )wtcb , list_waitingforsignal ());
113-
114- /* Add the task to ready-to-run task list, and
115- * perform the context switch if one is needed
116- */
117-
118- if (nxsched_add_readytorun (wtcb ))
119- {
120- up_switch_context (this_task (), rtcb );
121- }
88+ nxsig_wait_irq (wtcb , SIG_WAIT_TIMEOUT , SI_TIMER , ETIMEDOUT );
12289 }
12390
12491 leave_critical_section (flags );
@@ -137,15 +104,15 @@ static void nxsig_timeout(wdparm_t arg)
137104 *
138105 ****************************************************************************/
139106
140- #ifdef CONFIG_CANCELLATION_POINTS
141- void nxsig_wait_irq ( FAR struct tcb_s * wtcb , int errcode )
107+ void nxsig_wait_irq ( FAR struct tcb_s * wtcb , uint8_t signo ,
108+ uint8_t code , int errcode )
142109{
143110 FAR struct tcb_s * rtcb = this_task ();
144111
145112 if (wtcb -> sigunbinfo != NULL )
146113 {
147- wtcb -> sigunbinfo -> si_signo = SIG_CANCEL_TIMEOUT ;
148- wtcb -> sigunbinfo -> si_code = SI_USER ;
114+ wtcb -> sigunbinfo -> si_signo = signo ;
115+ wtcb -> sigunbinfo -> si_code = code ;
149116 wtcb -> sigunbinfo -> si_errno = errcode ;
150117 wtcb -> sigunbinfo -> si_value .sival_int = 0 ;
151118#ifdef CONFIG_SCHED_HAVE_PARENT
@@ -159,15 +126,14 @@ void nxsig_wait_irq(FAR struct tcb_s *wtcb, int errcode)
159126 dq_rem ((FAR dq_entry_t * )wtcb , list_waitingforsignal ());
160127
161128 /* Add the task to ready-to-run task list, and
162- * perform the context switch if one is needed
163- */
129+ * perform the context switch if one is needed
130+ */
164131
165132 if (nxsched_add_readytorun (wtcb ))
166133 {
167134 up_switch_context (this_task (), rtcb );
168135 }
169136}
170- #endif /* CONFIG_CANCELLATION_POINTS */
171137
172138/****************************************************************************
173139 * Name: nxsig_clockwait
0 commit comments