def test_wait_for_interrupt_submitted(self): # Test KEVENT_STATUS_SUBMITTED proc = coro_process.spawn_job_bg('sleep 30') def waiter(): proc.wait() waiter_thread = coro.spawn(waiter) coro.yield_slice() # Waiter has submitted its kevent. # Interrupt it before it fires. waiter_thread.shutdown() coro.yield_slice()
def test_wait_for_interrupt_new(self): # Test KEVENT_STATUS_NEW proc = coro_process.spawn_job_bg('sleep 30') def waiter(): proc.wait() waiter_thread = coro.spawn(waiter) def killer(): waiter_thread.shutdown() coro.spawn(killer) # Waiter should be scheduled to run. # It will add kevent to changelist, then yield. # Then killer should be scheduled to run next. It # will reschedule waiter with an exception. # Waiter should then wake up and hit the # KEVENT_STATUS_NEW cleanup code path. coro.yield_slice()