Thanks for your responses. I saw pconn-sapi it's very similar threaded example that I want to implement.
I've crated non blocking Event loop in my C++ application ( it's high load binary API server ) , and now I'm trying to integrate PHP SAPI for writing some customisable scripts using PHP functions. My app starting PHP SAPI with function php_embed_init(argc, argv PTSRMLS_CC); and it stays alive always , because it will take some preference from my app if I'll start and end PHP SAPI on every PHP script parsing or function call. And based on that now my main problem is that in PHP C++ sources there are a lot of static, global variables which is not useful for me, to clean that all for every request .... So I'm wondering to build something which will help to somehow "save current state" of PHP SAPI , and continue it on every request from saved source, without sharing any variable between multiple requests. Let me know if you didn't get my idea. Now I'm trying to do this thing for my Startup project, but I'll share it over GitHub if I'll have some success :) Thanks. 2014-11-20 15:34 GMT+04:00 Johannes Schlüter <johan...@schlueters.de>: > On Thu, 2014-11-20 at 19:19 +0800, 兰 肖鲁 wrote: > > How about writing this logic in an extension? Because u can write > > your own RSHUTDOWN function to protect your data. > > Sorry, I have no idea what logic you want to put in a rshutdown and what > data you want to protect. And how that relates to this discussion around > SAPIs. > > johannes > > >