You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make a data bus with this lib and have a problem. When thread begins reading from stream, it uses 100% cpu.
Here is the example:
let (send, recv) = multiqueue::broadcast_queue(10);
let result = recv.recv(); // <-- while we are here, cpu is 100% hot
Is there a way not to use 100% cpu for reading/waiting? Tried multiqueue::broadcast_fut_queue() - got the same, but I think may be I don't understand some basics. I'm not very experienced in rust.
I'm not talking about async, just want thread not using 100% cpu while it is waiting for new message.
P.S. In some cases I saw cpu goes down to 2-4%, but I am not sure if that was not my code logic mistake.
I'm trying to make a data bus with this lib and have a problem. When thread begins reading from stream, it uses 100% cpu.
Here is the example:
Is there a way not to use 100% cpu for reading/waiting? Tried
multiqueue::broadcast_fut_queue()
- got the same, but I think may be I don't understand some basics. I'm not very experienced in rust.I'm not talking about async, just want thread not using 100% cpu while it is waiting for new message.
P.S. In some cases I saw cpu goes down to 2-4%, but I am not sure if that was not my code logic mistake.
Env:
MacOS 11.6
rustc 1.55.0 (c8dfcfe04 2021-09-06)
The text was updated successfully, but these errors were encountered: