1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

RepaintSignal now implements Sync so it can be sent to another thread

Fixes https://github.com/emilk/egui/issues/82
This commit is contained in:
Emil Ernerfeldt
2020-12-27 10:49:26 +01:00
parent af1df8d339
commit 958fc2753a
3 changed files with 14 additions and 5 deletions

View File

@@ -55,7 +55,7 @@ pub struct IntegrationContext<'a> {
pub tex_allocator: Option<&'a mut dyn TextureAllocator>,
/// Where the app can issue commands back to the integration.
pub output: AppOutput,
/// If you need to request a repaint from another thread, clone this and give to that other thread
/// If you need to request a repaint from another thread, clone this and send it to that other thread.
pub repaint_signal: std::sync::Arc<dyn RepaintSignal>,
}
@@ -113,7 +113,7 @@ pub trait TextureAllocator {
fn free(&mut self, id: crate::TextureId);
}
pub trait RepaintSignal: Send {
pub trait RepaintSignal: Send + Sync {
/// This signals the Egui integration that a repaint is required.
/// This is meant to be called when a background process finishes in an async context and/or background thread.
fn request_repaint(&self);