1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Clarify documentation regarding signals and EINTR.

This commit is contained in:
Martin Ling 2013-11-27 14:12:12 +00:00
parent 859874648e
commit b87deb7c70

View File

@ -758,11 +758,11 @@ enum sp_return sp_set_flowcontrol(struct sp_port *port, enum sp_flowcontrol flow
/** /**
* Read bytes from the specified serial port, blocking until complete. * Read bytes from the specified serial port, blocking until complete.
* *
* @warning If your program runs on Unix and makes use of signal handlers, * @warning If your program runs on Unix, defines its own signal handlers, and
* note that this function will repeat blocking system calls that * needs to abort blocking reads when these are called, then you
* are interrupted by a signal and return with EINTR. If your program * should not use this function. It repeats system calls that return
* needs to abort blocking reads when a signal is handled, you will * with EINTR. To be able to abort a read from a signal handler, you
* need to implement your own loop using sp_nonblocking_read() * should implement your own blocking read using sp_nonblocking_read()
* together with a blocking method that makes sense for your program. * together with a blocking method that makes sense for your program.
* E.g. you can obtain the file descriptor for an open port using * E.g. you can obtain the file descriptor for an open port using
* sp_get_port_handle() and use this to call select() or pselect(), * sp_get_port_handle() and use this to call select() or pselect(),
@ -803,11 +803,11 @@ enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf, size_t count
* been transmitted, use the sp_output_waiting() function. To wait until all * been transmitted, use the sp_output_waiting() function. To wait until all
* written bytes have actually been transmitted, use the sp_drain() function. * written bytes have actually been transmitted, use the sp_drain() function.
* *
* @warning If your program runs on Unix and makes use of signal handlers, * @warning If your program runs on Unix, defines its own signal handlers, and
* note that this function will repeat blocking system calls that * needs to abort blocking writes when these are called, then you
* are interrupted by a signal and return with EINTR. If your program * should not use this function. It repeats system calls that return
* needs to abort blocking reads when a signal is handled, you will * with EINTR. To be able to abort a write from a signal handler, you
* need to implement your own loop using sp_nonblocking_read() * should implement your own blocking write using sp_nonblocking_write()
* together with a blocking method that makes sense for your program. * together with a blocking method that makes sense for your program.
* E.g. you can obtain the file descriptor for an open port using * E.g. you can obtain the file descriptor for an open port using
* sp_get_port_handle() and use this to call select() or pselect(), * sp_get_port_handle() and use this to call select() or pselect(),