Hi everyone!
I am making a scgi library(yeah, I know that there lots of them already), and I have a problem. I am using libev for event based system with non blocking synchronous io. I need to manage somehow to make it possible for user to do non blocking io as well. I have been considering two approaches. The first one is to use contexts, but they are non standart and theoretically very memory consuming(it will have to copy the whole stack, which is by default about several mbs compared to my less-than-20-kb-per-connection-schema, right?). The second one is saving pointer to function which will be executed on readines of the io, save data in user defined structure pointed to by special "void *user_data" field, and wait for another event, upon which, execute specified "next function". But this is complex and inconvinient. What would you suggest?