SwooleAlthough the 2016 co-process feature is supported in the year, the underlying is an implementation-based setjmp/longjmp stackless scenario. Therefore, in some scenarios, such as call_user_func ,, array_map , __destruct can not use the co-process. In large applications, where logic is very complex and collaborative, it is easy for developers to step on the pit. The use of the coprocessor in a forbidden scene API can cause a variety of inexplicable problems to occur. Limits the scope of application of the association.
The new 4.0 version boost.context 1.60 implements the new coprocessor kernel based on the assembly code. On the basis of saving the PHP function call stack, the C context store of the stack is added. Support for all PHP grammars is implemented. Now in any PHP function, including call_user_func , Reflection, magic method, array_map can use the association.
now that you can PHP use the process anywhere in your code , developers no longer need to worry about using scenarios. 4.0version We have worked closely with the SwooleDistributed Swoft EasySwoole framework authors, and have done a grayscale trial in a large number of projects. Both stability and robustness have reached industrial level. Fully available in a production environment for large projects.
go(function() { array_map("test", array("func start\n")); echo "co end\n";}); function test($p) { echo $p; co::sleep(1); echo "func end \n";}
4.0 The branch is using the
C++11 standard, recommended
gcc-4.8 or later version.
Global variable Isolation
The global variables are isolated from the bottom of the new version and can now be used to Swoole\Process create multiple Swoole\Server instances.
for ($i = 0; $i < 2; $i++){ $p = new swoole_process(function () use ($i) { $port = 9501 + $i; $http = new swoole_http_server("127.0.0.1", $port); $http->on("start", function ($server) use ($port) { echo "Swoole http server is started at http://127.0.0.1:{$port}\n"; }); $http->on("request", function ($request, $response) { $response->header("Content-Type", "text/plain"); $response->end("Hello World\n"); }); $http->start(); }, false, false); $p->start();}
Other updates
- Fix
http2 Chrome an issue where the server cannot send more data to the browser client 16K
BASE Task issue where process cannot be restarted in Repair mode
- Add
Channel->peek a method for peering into data
- Fixed
Server->pause/resume an SWOOLE_PROCESS issue that could not be used under
- Removed
Linux AIO , and now regardless of setting uses thread pooling to implement asynchronous filesIO
- Supporting
MySQL stored Procedures
Download 4.0
- Github:https://github.com/swoole/swo ...
- Open source China: Https://gitee.com/swoole/swoo ...
- pecl:https://pecl.php.net/package/...