threads_internal: add 'thread_switch_to_master()' internally
In progress: moving more model-checking/thread actions so that they are
performed only by a system thread, not by the user code.
For now, we replace our uses of thread_yield() (which simply switched to the
next user thread) while thread_switch_to_master() (which will later perform
intermediate actions before choosing the next user thread).
Also, we can begin creating internal and external interfaces in
threads_indernal.h and libthreads.h, respectively.