Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous background processing? #18

Open
dascandy opened this issue Dec 5, 2015 · 3 comments
Open

Asynchronous background processing? #18

dascandy opened this issue Dec 5, 2015 · 3 comments

Comments

@dascandy
Copy link

dascandy commented Dec 5, 2015

While looking through the examples I cannot find how to not immediately send back a reply, but instead to have some form of handle stored so that it will be returned later, after the background task returned a reply. This would block the connection on HTTP.

@wolkykim
Copy link
Owner

Yes, as you mentioned, this part has to be handled in user code, you could implement a set of queuing buffer mapped to each connection. And this delayed response better to be handled in separate threads, not to block the callback since the callback is single-threaded model anything blocking the callback will block the whole process.

@dascandy
Copy link
Author

I understand how to not block the call, but what kind of value do I return to indicate "I'm processing this connection on a separate thread, please continue processing other connections but don't do anything to this connection until I tell you I'm done" ?

@wolkykim
Copy link
Owner

I guess you need to save the underlying *conn object in your threads and send data using the conn from the threads. I think you can also use ad_conn_set_userdata() call to store the status information if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants