Fix dregister not being thread safe.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-08-04 19:10:14 +02:00
parent fdc41cac76
commit 395f7b29b4
1 changed files with 2 additions and 0 deletions

View File

@ -30,8 +30,10 @@ extern "C" pthread_mutex_t __dirname_lock;
extern "C" void dregister(DIR* dir)
{
pthread_mutex_lock(&__dirname_lock);
dir->flags |= _DIR_REGISTERED;
if ( (dir->next = __firstdir) )
dir->next->prev = dir;
__firstdir = dir;
pthread_mutex_unlock(&__dirname_lock);
}