Function zng_view::run_same_process
source · pub fn run_same_process(run_app: impl FnOnce() + Send + 'static)
Expand description
Runs the view-process server in the current process and calls run_app
to also
run the app in the current process. Note that run_app
will be called in a different thread.
In this mode the app only uses a single process, reducing the memory footprint, but it is also not resilient to video driver crashes, the view server does not respawn in this mode.
§Panics
Panics if not called in the main thread, this is a requirement of some operating systems.
§Background Panics Warning
Note that webrender
can freeze due to panics in worker threads without propagating
the panics to the main thread, this causes the app to stop responding while still receiving
event signals, causing the operating system to not detect that the app is frozen. It is recommended
that you build with panic=abort
or use std::panic::set_hook
to detect these background panics.
§Android
In Android builds android::init_android_app
must be called before this function, otherwise it will panic.