edef1c / libfringe

a Rust library implementing safe, lightweight context switches, without relying on kernel services
https://edef1c.github.io/libfringe
Apache License 2.0
512 stars 31 forks source link

Releasing owned resources on Generator drop #57

Open cstorey opened 8 years ago

cstorey commented 8 years ago

I notice that there's no Drop implementation for Generator, and so it looks like it's owned stack won't get unwound, and so any resources owned by a Generator's stack will get leaked.

So, it seems that that the only way currently to forcefully unwind a generator's stack is to pass in a value that asks it to panic, such as in this example. Is that right?

I notice that context-rs has the ability to spawn a function on top of a recovered stack, which might be an option for future implementation. But that seems quite risky.

Amanieu commented 8 years ago

See #52