function thread_switch

static int thread_switch(int n)