@@ -25,6 +25,7 @@ use compio_buf::BufResult;
2525use compio_log:: instrument;
2626
2727mod macros;
28+ mod panic;
2829
2930mod key;
3031pub use key:: Key ;
@@ -49,7 +50,7 @@ pub use cancel::*;
4950
5051mod control;
5152
52- use crate :: { key:: ErasedKey , op:: OpCodeFlag } ;
53+ use crate :: { key:: ErasedKey , op:: OpCodeFlag , panic :: resume_unwind_io } ;
5354
5455mod sys_slice;
5556
@@ -276,12 +277,15 @@ impl Proactor {
276277 ///
277278 /// # Panics
278279 ///
279- /// This function will panic if the [`Key`] is not unique.
280+ /// This function will panic if the [`Key`] is not unique or if the
281+ /// operation is blocking and it panicked in the thread pool.
280282 pub fn pop < T : OpCode > ( & mut self , key : Key < T > ) -> PushEntry < Key < T > , BufResult < usize , T > > {
281283 instrument ! ( compio_log:: Level :: DEBUG , "pop" , ?key) ;
282284 if key. has_result ( ) {
283285 self . cancel . remove ( & key) ;
284- PushEntry :: Ready ( key. take_result ( ) )
286+ let ( res, buf) = key. take_result ( ) . into_parts ( ) ;
287+
288+ PushEntry :: Ready ( BufResult ( resume_unwind_io ( res) , buf) )
285289 } else {
286290 PushEntry :: Pending ( key)
287291 }
@@ -292,7 +296,8 @@ impl Proactor {
292296 ///
293297 /// # Panics
294298 ///
295- /// This function will panic if the [`Key`] is not unique.
299+ /// This function will panic if the [`Key`] is not unique or if the
300+ /// operation is blocking and it panicked in the thread pool.
296301 pub fn pop_with_extra < T : OpCode > (
297302 & mut self ,
298303 key : Key < T > ,
@@ -301,8 +306,8 @@ impl Proactor {
301306 if key. has_result ( ) {
302307 self . cancel . remove ( & key) ;
303308 let extra = key. swap_extra ( self . default_extra ( ) ) ;
304- let res = key. take_result ( ) ;
305- PushEntry :: Ready ( ( res, extra) )
309+ let ( res, buf ) = key. take_result ( ) . into_parts ( ) ;
310+ PushEntry :: Ready ( ( BufResult ( resume_unwind_io ( res) , buf ) , extra) )
306311 } else {
307312 PushEntry :: Pending ( key)
308313 }
0 commit comments