Skip to content

Confusion on using wait() vs. add_callback() #408

Answered by JoelBender
MitchCayCRC asked this question in Q&A
Discussion options

You must be logged in to vote

The callback function is only called when the request has been completely processed by the controller, before that it might be sitting in a queue or only be partially processed. When you give an iocb to a controller it is no longer yours, like a buffer that you have given to the old school fgets() and fputs() stdio functions. You can look at the status code (polling-like) and do something with the results, pass a callback like you are doing now, or in a multi-threaded application - - not recommended - - call wait() and your thread will be suspended until the event (semaphore) is set (signaled).

If an IOController has been given an IOCB instance, then in theory it is also responsible for d…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MitchCayCRC
Comment options

@JoelBender
Comment options

Answer selected by MitchCayCRC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants