Function hexchat_api::turn_off_threadsafe_features
source · pub unsafe fn turn_off_threadsafe_features()
features = []
in the Cargo.toml file for the hexchat-api
dependency.Expand description
Stops and removes the main thread task queue handler. Otherwise it will keep checking the queue while doing nothing useful - which isn’t necessarily bad. Performance is unaffected either way.
Support for main_thread()
is on by default. After this function is
invoked, main_thread()
should not be used and threads in general risk
crashing the software if they try to access Hexchat directly without
the main_thread()
. ThreadSafeContext
and ThreadSafeListIterator
should also not be used after this function is called, since they rely on
main_thread()
internally.
Safety
While this will disable the handling of the main thread task queue, it
doesn’t prevent the plugin author from spawning threads and attempting to
use the features of the threadsafe objects this crate provides. If the
plugin author intends to use ThreadSafeContext
, ThreadSafeListIterator
,
or invoke main_thread()
directly, then this function should not be called.