Also when sched_yield is called the thread that called it gets put back in the queue, but when it gets its turn to run on the cpu again does it start executing the line after the sched_yield call?
int param;int main(int argc, char *argv[]){ pthread_t thread1, thread2, thread3; int t_return1, t_return2, t_return3; param = 1; t_return1 = pthread_create(&thread1,NULL,Function,NULL); t_return2 = pthread_create(&thread2,NULL,Function,NULL); t_return3 = pthread_create(&thread3,NULL,Function,NULL); pthread_join(thread1,NULL); pthread_join(thread2,NULL); pthread_join(thread3,NULL); cin.get(); return 0;}void *Function(void *ptr){ while(param < p_argc) { //...cut code..\\ if(i == str_len-1) { param++; } sched_yield(); } pthread_exit(NULL);}