Closed gizahNL closed 3 years ago
Calling read/write before epoll seems interesting. Does libsrt even ensure that read/write do not block if you didn't poll before?
Calling read/write before epoll seems interesting. Does libsrt even ensure that read/write do not block if you didn't poll before?
According to the SRT API Documentation it returns SRT_EASYNCRCV (reading) or SRT_EASYNCSND (writing) when calling functions that would block. So from what I'd expect it should be safe to try first before polling and trying again, in native C the overhead of polling would be more limited but from what I've gathered there is quite a overhead when calling into C from go, so the advise is to limit those calls.
There is some pending conflict after the latest PR merge.
I just rebased, should be good now :)
@gizahNL, one question (just curious). As you did with error management to reduce the number of cgo calls, do you think it would make sense to also move srt_epoll_uwait calls to the C function?
@gizahNL, one question (just curious). As you did with error management to reduce the number of cgo calls, do you think it would make sense to also move srt_epoll_uwait calls to the C function?
It's definitely possible, though I think there is a bigger gain in moving those calls into a central pollserver that does the polling for all sockets, as that would limit the amount of cgo calls that can block. (see my other WIP PR)
This expands upon #35
For the read & write calls the error fetching is moved into one C call, reducing cgo calls (and additional performance costs of those).
non-blocking mode is improved by first trying to write/read and checking if we are returned an AGAIN error type, only then we start to poll and try again after the socket becomes readable/writable.