Terminating blocking read function

Does any body know how to terminate a blocking read function? Usually closing the file descriptor will make the read function return. This does not work with the ARM GNU compiler.

I need answer too! I have tried with kill(processNbr, SIGABRT), but I don’t know what processNbr to fill in. I have also tried with tx_thread_wait_abort(pThread), but nothing happens when I call this function. Anyone who knows the answer to this question? Best regards, Per

I’d use select() with an appropriate timeout in a loop and use a flag which indicates if we should again wait for input on the fd if timed out. you then read with a nonblock read from the fd after select returns with the expected fd_set.

Thanks a lot for your reply Momo. However, we have now solved our problem according to the following: Replace the following code on line 3748 in file C:
etos_serl.c tx_thread_sleep(1); /* block / with the following code: if (tx_thread_sleep(1) != TX_SUCCESS) { PUT_SEMA(&r_sem[pChannel->serChannel]) return EINTR; } It will then be possible to terminate the blocking read with the following call from another thread. txStatus = tx_thread_wait_abort(pThread); / Abort the suspension condition */ The call will abort the tx_thread_sleep with the return value TX_WAIT_ABORTED instead of TX_SUCCESS. The read function will then return -1.