| 20 | } |
| 21 | |
| 22 | void fiber_waiter::run(void) { |
| 23 | log_info(">>>waiter fiber started!"); |
| 24 | |
| 25 | // can't call any jni function in fiber. |
| 26 | // test(); |
| 27 | |
| 28 | while (true) { |
| 29 | // blocking wait for one task; |
| 30 | http_task* t = box_->pop(); |
| 31 | |
| 32 | // pop one http task and create one fiber to handle it |
| 33 | go_stack(1024000)[=] { |
| 34 | http_get request(t); |
| 35 | request.run(); |
| 36 | t->done(); |
| 37 | }; |
| 38 | } |
| 39 | } |