(&mut self)
| 178 | |
| 179 | impl Drop for Canvas { |
| 180 | fn drop(&mut self) { |
| 181 | // The streams drop if this is the last canvas with this core |
| 182 | self.core.sync(|core| { |
| 183 | if core.main_core.finish_usage() == 0 { |
| 184 | // Close all the streams and then wake them up |
| 185 | core.streams.drain(..) |
| 186 | .map(|stream| { |
| 187 | if let Some(stream) = stream.upgrade() { |
| 188 | stream.sync(|stream| { stream.close(); stream.take_waker() }) |
| 189 | } else { |
| 190 | None |
| 191 | } |
| 192 | }) |
| 193 | .flatten() |
| 194 | .for_each(|waker| waker.wake()); |
| 195 | } |
| 196 | }); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /// |
nothing calls this directly
no test coverage detected