How to block thread with timeout ?

I read /dev/ser1 in thread#1 (using notify())
and I want to wait in thread#2 until I read 4 chars or timeout occur (5 s).

How to do that?
/not by polling (it gets processor time/power)

Q wrote:

I read /dev/ser1 in thread#1 (using notify())
and I want to wait in thread#2 until I read 4 chars or timeout occur (5 s).

How to do that?
/not by polling (it gets processor time/power)

There are a number of ways to do it, but you’re probably best
off using the ordinary “select” and “read” mechanisms, which
are well documented. QNX has some other mechanisms if you
have very fast serial inputs to service, but unless you do,
don’t bother.

John Nagle