Make sure that the sequence rts_lock(); rts_unlock(); /* (with nothing in between) */ doesn't crash the threaded RTS.