Post by joe durusauIt's not clear why you would want a task to proceed when it has
nothing to do.
In most cases, a task that is doing IO should block until something is
ready. Select
is the mechanism of choice if you have multiple sockets open. You will
only
create a mess if you try of overide blocking on STREAM sockets. With
DGRAM sockets, you could use non-blocking sockets, provided that you did
something about retrying as required.
As to your question about the sim, sorry, I don't know, never used it.
Well, in this case, the (stream) socket reader task needs to
periodically un-block to check a status variable to determine whether it
should exit. There is a separate task which manages a connection
heartbeat. In the event of a heartbeat timeout, a variable is set
indicating that the socket reader and writer tasks should exit.
Problem is, the socket reader task is forever blocked on a socket read.
I had hoped to allow it break out after periods of inactivity using
SO_RCVTIMEO so that it could check the heartbeat status. However, the
SO_RCVTIMEO option doesn't seem to have any effect, at least in
VxSim...the task remains forever blocked in recv().
I understand that I can use select() to only do a recv() when there is
pending data to be read. It looks like that is my only option if the
SO_RCVTIMEO socket option is non-functional in VxWorks.