As a quick test, I made pthread_cond_wait call to pthread_sem_take with the 
last argument to true (which then use the interruptible version) and it now 
cancels the wait. So it would seem that this is a bug right?

Best,
Matias

On Tue, Jan 12, 2021, at 20:13, Matias N. wrote:
> Hi,
> I'm having an issue when waiting on a pthread condition variable from the 
> main thread and then a signal handler runs, which should cancel the wait 
> since I have cancellation points enabled, however this did not happen. While 
> debugging I see the main thread blocked when standing inside the signal 
> handler. Here's the call graph at that point:
> 
> If I continue execution, the main thread never runs. I'm wondering if that 
> call to nxsem_wait_uninterruptible is correct since it would seem that is 
> exactly why this is not being canceled.
> 
> Note that I was initially signaling the condition variable from within the 
> signal handler but this did not work either. However, looking at pthread 
> documentation this is supposedly not supported: 
> https://linux.die.net/man/3/pthread_cond_signal
> (I'm not sure if that really applies to NuttX though).
> 
> Also, I'm mixing signals with threads because I'm using POSIX timers which 
> require signals to be handled, so I'm stuck with this. I think supporting 
> timerfd would be really useful (as I could then have a thread that waits on 
> the fd of the timer).
> 
> Best,
> Matias
> 
> *Attachments:*
>  * image.png

Reply via email to