That's the part that is difficult: Efficient wake up on completion.
Network I/O is usually monitored via a so called I/O loop. Local file I/O are often not exposed with asynchronous APIs (yes I know it's changing on linux quickly). But what about locks? Let's say you want a tread safe queue, how do you wake up the right function when the mutex is unlocked? I suspect this is the reason of all this complexity.
Network I/O is usually monitored via a so called I/O loop. Local file I/O are often not exposed with asynchronous APIs (yes I know it's changing on linux quickly). But what about locks? Let's say you want a tread safe queue, how do you wake up the right function when the mutex is unlocked? I suspect this is the reason of all this complexity.