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
The current implementation of LocalIo involves unsafe borrowing which doesn't transfer ownership of the IoFactory. This unsafe code allows for mutably aliasing the IoFactory multiple times on the stack (leading to memory unsafety).
Fixing this would involve dancing around transferring ownership of the IoFactory between the calls that it makes. My initial idea was for LocalIo to take ownership and give out &mut loans to it, but this is insufficient because when a green task context switches the scheduler must again have ownership of the IoFactory.
My best idea for doing this right now is to change all methods on IoFactory to take ~self and then right before the M:N methods block they would transfer ownership back to the scheduler. All the 1:1 methods would basically immediately return ownership of the factory back to the local Task.
The text was updated successfully, but these errors were encountered:
The current implementation of
LocalIo
involves unsafe borrowing which doesn't transfer ownership of theIoFactory
. This unsafe code allows for mutably aliasing theIoFactory
multiple times on the stack (leading to memory unsafety).Fixing this would involve dancing around transferring ownership of the
IoFactory
between the calls that it makes. My initial idea was forLocalIo
to take ownership and give out&mut
loans to it, but this is insufficient because when a green task context switches the scheduler must again have ownership of theIoFactory
.My best idea for doing this right now is to change all methods on
IoFactory
to take~self
and then right before the M:N methods block they would transfer ownership back to the scheduler. All the 1:1 methods would basically immediately return ownership of the factory back to the localTask
.The text was updated successfully, but these errors were encountered: