Implement UnwindSafe by never returning on panic#239
Implement UnwindSafe by never returning on panic#239fabianfreyer wants to merge 3 commits intodeadpool-rs:mainfrom
Conversation
Don't return objects to the pool on panic, since we can't be sure whether they were the source of the panic. See-also: deadpool-rs#139
|
I think you accidentally mixed the The |
|
Hmm, I guess both should have the marker then? |
|
I'm just revisiting this as part of a overall repository clean-up. Not returning objects on panic is a good idea for the managed pool. For the unmanaged pool hower this could cause some rather pesky side effects. It's unmanaged for a good reason: You create all the objects you need and then just use them forever. If a panic doesn't crash the application altogether it might end up with an empty pool waiting forever. One way I could think about was the following:
It's just my gut feeling that discarding objects on panic only ever makes sense if panics are handled and then you really need to make sure that the pool gets refilled. I can imagine only very few users would expect that to be the case. |
2f4d3ba to
b1cf396
Compare
7a9da3d to
f713c85
Compare
54f37b5 to
b134227
Compare
Don't return objects to the pool on panic, since we can't be sure whether they were the source of the panic.
See-also: #139