-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signal panicking when being set in a separate thread #603
Comments
Spawning the async task with tokio is probabl causing this, just move the task out of it spawn(async move {
while let Ok(event) = terminal_event_rx.recv() {
match event {
TerminalEvent::Redraw {
lines,
cursor,
scroll_top,
} => {
*rendered_lines.write() = lines;
*rendered_cursor.write() = (cursor.x, cursor.y as usize);
*rendered_scroll_top.write() = scroll_top;
}
}
}
}); |
Moving it outside the tokio task will actually block the main thread & the app freezes. I tried using |
Can't you just use a non-blocking, async-friendly channel instead of crossbeam ? Like https://docs.rs/tokio/latest/tokio/sync/mpsc/fn.unbounded_channel.html |
I've just switched to But now I run into the old bug in #602. Maybe something is blocking the thread again 馃槩 I'll investigate more. |
Can you try with tokio just in case? |
Btw I wonder if for the terminal renderer it would be better to use the canvas directly, that would surely be more performant |
Yep. Same thing happen using tokio channel.
Here's my branch for the tokio channel if you want to check it out: |
But yeah. Implementing in cavas would indeed be more performant & avoid blocking UI thread problem. I'll try that instead! |
I ran into this issue when I have a
SyncSignal
being updated in a thread. I think it got something to do with it being set too quickly between render? 馃Here is the error that I got:
Here's a link to that line that the error was complaining about:
https://github.com/ZeroX-DG/raven/blob/112e867d68d61d2b5a78f7cddac9e4f7e02a44a1/src/components/content_area.rs#L71 #
The text was updated successfully, but these errors were encountered: