lval: better support for lua threads.