Never mind, I have discovered that using sigsetjmp/siglongjmp rather than setjmp/longjmp makes this work.