two threads going to do func()

Posted by nisnis84 on Stack Overflow See other posts from Stack Overflow or by nisnis84
Published on 2010-04-23T15:59:05Z Indexed on 2010/04/23 17:53 UTC
Read the original article Hit count: 171

Filed under:
|
|

2 threads going to use the same func().
The 2 threads should be mutually exclusive. How do I get it to work properly?
(output should be "abcdeabcde")

char arr[] = "ABCDE";
int len = 5;

void func(){
for(int i = 0; i <len;i++)
  printf("%c,arr[i]);   
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about c