the description is not clear. Please look at the code and the result directly. Thank you.
void * product (void * arg) {
int rear = 0 ; while(1) { rear = (rear + 1)%5; printf("p:%d\n",rear); Sleep(500); } }
int main (void) {
pthread_t pid; pthread_create(&pid,NULL,product,NULL); pthread_join(pid,NULL); return 0; }
guess that the sequential output should be 0123401234, but this is not the case. Excuse me, what"s going on?