Struct backdrop::thread::GlobalTrashThreadStrategy
source · pub struct GlobalTrashThreadStrategy();
std
only.Expand description
Strategy which sends any to-be-dropped values to a dedicated global ‘trash thread’
This trash thread is a global thread that is started using lazy_static
.
You probably want to control when it is started using [lazy_static::initialize(&GLOBAL_TRASH_THREAD_HANDLE)
]
(If you do not, it is started when it is used for the first time,
meaning the very first drop will be slower.)
Sending is done using a std::sync::mpsc::sync_channel
.
In the current implementation, there are 10 slots available in the channel
before a caller thread would block.
Also note that this global, detached, thread, will not be joined/cleaned up when your program exits. This is probably fine, though it might mean that a few final destructors are not run. But be aware that tools like e.g. Miri complain about this.