Terminate Serial blocking read()

I am using the BSP serial port read() function in blocking mode.
I would like to “wake-up”/terminate the read from another thread to handle a graceful shutdown. I tried using the API:
with no luck.
I found on the forum someone suggested modifying the BSP in the following thread:

However this thread is quite old and the BSP has been changed so this suggestion is out-dated. I also prefer not to modify the BSP from a maintenance perspective.
I know I can handle this various ways, one of which is to switch to a non-blocking mode and using something like:
to do check for valid input, or even use the select(…) function.

I also prefer not to do this as the blocking read() is an elegant solution from a threading point of view, I just need to handle the fringe case of waking it up.
Has anything been added to NET+OS to allow terminating the read() function?

Thanks in advance.



you say something like a timeout?. I don’t found a timeout for function “read()” .

Most applications that wish to accomplish what you wish to accomplish use a select statement. This is done on serial ports and networking ports (sockets). NET+OS’s select has supported serial and sockets since around V6.3. To me this would seem cleaner thsn attempting to wake up ports. That approach would seem from the outside to have more potential side effects then benefits.