On Tue, 25 Apr 2017, Rui Wang via curl-library wrote:

What I want to do is to process the attributes or the data as it arrives instead of waiting for everything. I could use the writefunction to parse the data and extracts attributes or data when it's ready. However, I can only write that data to somewhere, but I can't pipe that data item into another function since the function signature is already there.

Sorry but I can't parse this. You get the data in the callback, if you need or want to pass that data on to somewhere else, why can't you just do that?

You could do it with a queue/pipe and the consumer of that could either run in a separate thread, or if you for example use the multi interface you could have it "interleaved" with the regular transfer. Whatever you think is best for you.

What I could think of is to make a queue, and writefunction would send the
data item into the queue, another thread keeps checking the queue and
processes the element once it's there. This is way more complicated than
the callback, if it exists.

If you rather do a callback from within the callback, just do it!

--

 / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to