Mutex takes a long while to unlock
Posted
by l.thee.a
on Stack Overflow
See other posts from Stack Overflow
or by l.thee.a
Published on 2010-05-18T23:10:30Z
Indexed on
2010/05/18
23:30 UTC
Read the original article
Hit count: 275
I have two threads. First one is something like this:
while(1)
{
pthread_mutex_lock(&mutex);
//DO WORK
pthread_mutex_unlock(&mutex);
pthread_yield();
}
The second one locks the mutex on user event, change some settings and unlocks. Thread one does ~ 200 iterations a second. However on occasion it takes the second thread up to 3 seconds to get active (to unlock the mutex). How do I ensure faster response?
© Stack Overflow or respective owner