- Notifications
You must be signed in to change notification settings - Fork20
-
Hello, I was wondering if threads or even I don't know rust much, sorry. Thanks for this repository btw 🙏 |
BetaWas this translation helpful?Give feedback.
All reactions
You can spawn threads or async coroutine, spawn thread:https://doc.rust-lang.org/std/thread/fn.spawn.html, spawn coroutine using tokio:https://docs.rs/tokio/1.9.0/tokio/fn.spawn.html.
If you are using NTS mode, spawn threads or coroutine in module init function will be persistent, spawn threads or coroutine in request lifetime will be drop after request finished.
You can reference to http server example:https://github.com/jmjoy/phper/tree/master/examples/http-server.
Replies: 1 comment 1 reply
-
You can spawn threads or async coroutine, spawn thread:https://doc.rust-lang.org/std/thread/fn.spawn.html, spawn coroutine using tokio:https://docs.rs/tokio/1.9.0/tokio/fn.spawn.html. If you are using NTS mode, spawn threads or coroutine in module init function will be persistent, spawn threads or coroutine in request lifetime will be drop after request finished. You can reference to http server example:https://github.com/jmjoy/phper/tree/master/examples/http-server. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks for the answer, that was fast :) I've missed that example, sorry. |
BetaWas this translation helpful?Give feedback.