This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void* Thread_Operation() { | |
while (totalCount < m) { | |
// Variable to randomly generate values for operations | |
int random_value = rand() % 65535; | |
// Variable to randomly select one of the three operations | |
int random_select = rand() % 3; | |
// Member operation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
threadOperation(){ | |
. | |
. | |
. | |
if(memberFunction){ | |
pthread_rwlock_rdlock(&rwlock); | |
Member(random_value, head); | |
pthread_rwlock_unlock(&rwlock); | |
} | |
if(insertFunction){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pthread_mutex_lock(&total_mutex); | |
totalCount++; | |
pthread_mutex_unlock(&total_mutex); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jkl | |
jhkhl | |
jkljklj;ljlkj |