You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the closure passed to exec_async contains a reference, it might be executed even if the referenced value is gone / has changed. It's also possible to end up with +1 &mut T.
Wonder if there's something that could be done, like a 'static bound or something similar?
Example:
use core_foundation::runloop::CFRunLoopRun;use dispatch2::Queue;use std::thread;structX{y:u8,}implDropforX{fndrop(&mutself){println!("dropping X {{ {} }}",self.y);}}fnmutate(x:&mutX){let th = thread::current();let th = th.name();println!("mutating x ({}) from {th:?}", x.y);
x.y += 1;println!("x mutated (to ({})) from {th:?}, releasing exclusive access",
x.y
);}fnmain(){
thread::spawn(|| {letmut x = X{y:1};let queue = Queue::main();
queue.exec_async(|| {mutate(&mut x);});mutate(&mut x);});unsafe{CFRunLoopRun()};}
Output example (it might segfault instead):
The text was updated successfully, but these errors were encountered:
If the closure passed to
exec_async
contains a reference, it might be executed even if the referenced value is gone / has changed. It's also possible to end up with +1&mut T
.Wonder if there's something that could be done, like a
'static
bound or something similar?Example:
Output example (it might segfault instead):

The text was updated successfully, but these errors were encountered: