Skip to content

Instantly share code, notes, and snippets.

@JavaDeveloper
Created October 2, 2012 13:15
Show Gist options
  • Save JavaDeveloper/3819034 to your computer and use it in GitHub Desktop.
Save JavaDeveloper/3819034 to your computer and use it in GitHub Desktop.
unsigned int counter = 0;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
void* thread_method(void* parameter){
string s = *(string*)(parameter);
for(int i=0;i<4;i++){
counter++;
cout<<s<<": "<<counter<<endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment