getcontext() plus userlevel setcontext() (as used in libpthread) respects the atomicity of RAS regions.