Use of custom IO functions on non-custom fds
Posted: Thu May 17, 2018 2:54 pm
Hi,
Is it safe to use functions like SetHaveError() on a "regular" fd, to fire Select()? Such as with a TCP socket, where Select blocks forever in a high priority task, and a lower priority task is checking enet0.EtherLink() for LAN cable integrity, finds it bad, and calls SetHaveError() for that socket. I've only seen the docs for this refer to SetHaveError in terms of custom fds.
I would also like to use it to "force" serial port errors in Select from a lower priority task (without having the port encapsulated in a custom fd). The low priority task tests incoming CTS to know the host is connected. If we lose CTS, I'd like Select to fire with an error.
Lastly, I'd like to buffer some data to be sent via a standard TCP fd, from a lower priority task, then wake up Select with a SetWriteAvail() to then have the Select task code write the data out to the LAN. The idea is for the Select task to assemble a preamble, manage an application level sequence number, etc. to command packets coming from the lower priority task. Is that how it's supposed to work with the write fds Select set?
Thanks!
Ray
Is it safe to use functions like SetHaveError() on a "regular" fd, to fire Select()? Such as with a TCP socket, where Select blocks forever in a high priority task, and a lower priority task is checking enet0.EtherLink() for LAN cable integrity, finds it bad, and calls SetHaveError() for that socket. I've only seen the docs for this refer to SetHaveError in terms of custom fds.
I would also like to use it to "force" serial port errors in Select from a lower priority task (without having the port encapsulated in a custom fd). The low priority task tests incoming CTS to know the host is connected. If we lose CTS, I'd like Select to fire with an error.
Lastly, I'd like to buffer some data to be sent via a standard TCP fd, from a lower priority task, then wake up Select with a SetWriteAvail() to then have the Select task code write the data out to the LAN. The idea is for the Select task to assemble a preamble, manage an application level sequence number, etc. to command packets coming from the lower priority task. Is that how it's supposed to work with the write fds Select set?
Thanks!
Ray