[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Howto cancel a blocked termios read request



Wolfram Wadepohl wrote:
> i need to cancel a blocked termios read request.
>
> the request blocks at the tty->rawInBuf.Semaphore in fillBufferQueue():
>
> ...
>     /*
>      * Wait for characters
>      */
>     if ( wait ) {
>         sc = rtems_semaphore_obtain (tty->rawInBuf.Semaphore,
>             tty->rawInBufSemaphoreOptions,
>             timeout);
>         if (sc != RTEMS_SUCCESSFUL)
>             break;
>     }
> ...
>
> using ioctl to set c_cc[VMIN] = c_cc[VTIME] = 0 does not help, because 
> it changes only tty->rawInBufSemaphoreOptions, which will be in effect 
> for the *next* call to rtems_semaphore_obtain().
>
> should we put an extra rtems_semaphore_release() call in the code, 
> when we set tty->rawInBufSemaphoreOptions to RTEMS_NO_WAIT (line 571) 
> in case of c_cc[VMIN] = c_cc[VTIME] = 0?
>
> any other suggestions to cancel a blocked read?
Can that semaphore be flushed?  I don't know what the API would be to 
the user but that should
end up returning not satisfied.

It would also allow it to be canceled on a signal.

--joel
> thanks.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>