<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # enable_coroutine 根據 [RFC1011](https://github.com/swoole/rfc-chinese/issues/24) 實現 > enable_coroutine 選項相當于在回調中關閉以前版本的SW_COROUTINE宏開關, 關閉時在回調事件中不再創建協程,但是保留用戶創建協程的能力。 --- ### enable_coroutine選項影響范圍 所有原有自動創建協程的回調, 包括 - onWorkerStart - onConnect - onOpen - onReceive - redis_onReceive - onHandShake - onPacket - onRequest - onMessage - onPipeMessage - onClose - tick/after 定時器 ## 4.0以下版本 `2.0-4.0`版本默認會在`Server`的回調函數中自動創建協程,如果在此事件中未使用任何協程`API`,實際上是浪費的。而且造成了與`1.x`的不兼容性。 此外還包括`Timer`定時器的相關`API`也會自動創建協程。 ## 簡介 `enable_coroutine`參數,默認為`true`,通過設置為`false`可關閉內置協程。 ## 示例 ```php $http = new swoole_http_server("127.0.0.1", 9501); $http->set([ //關閉內置協程 'enable_coroutine' => false, ]); $http->on("request", function ($request, $response) { if ($request->server['request_uri'] == '/coro') { go(function () use ($response) { co::sleep(0.2); $response->header("Content-Type", "text/plain"); $response->end("Hello World\n"); }); } else { $response->header("Content-Type", "text/plain"); $response->end("Hello World\n"); } }); $http->start(); ``` - 當`enable_coroutine`設置為`true`時,底層自動在`onRequest`回調中創建協程,開發者無需自行使用`go`函數創建協程 - 當`enable_coroutine`設置為`false`時,底層不會自動創建協程,開發者如果要使用協程,必須使用`go`自行創建協程,如果不需要使用協程特性,則處理方式與`1.x`是`100%`一致的 ## 效果 - 重新兼容了`1.x` - 開發者有更大的自由度 - 移除`--enable-coroutine`編譯選項,減少`SW_USE_COROUTINE`宏開關的維護成本
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看