Does poll and (or) epoll save the current execution position in a program?

Viewed 36

I am working on a basic server which may use poll or epoll, but I cant seem to find any info for if: poll or epoll will resume where the underlying function left off.

For example: if I had a function which had operations to do after a blocking call like recv(), and I called poll on the recv(), when the recv call finishes, can the outer function just resume operation directly after the recv(), or does there need to be some kind of variable which holds where the function left off, which needs to be called again?

1 Answers

You have altogether the wrong idea. You don't (e)poll() the execution of a function call. Rather, you use (e)poll() to monitor the readiness of one or more file descriptors. You then use that information to choose which I/O operations to perform and when, generally by avoiding performing blocking operations on file descriptors when they are not ready to be serviced.

All of that is synchronous, so yes, trivially, (e)poll() saves the program position and returns to it, because that's how function calls work.

Related