threads_internal: add 'thread_switch_to_master()' internally