Alexandre Julliard : ntdll: Use a pthread mutex for the drive info section.
Alexandre Julliard
julliard at winehq.org
Mon Jul 13 16:08:50 CDT 2020
Module: wine
Branch: master
Commit: d7ef680e950431d868e6d52418513472af7edbb3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d7ef680e950431d868e6d52418513472af7edbb3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jul 13 18:45:04 2020 +0200
ntdll: Use a pthread mutex for the drive info section.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/file.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index c5ffd0166d..c90fac156a 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1871,13 +1871,14 @@ static NTSTATUS server_get_file_info( HANDLE handle, IO_STATUS_BLOCK *io, void *
/* retrieve device/inode number for all the drives */
static unsigned int get_drives_info( struct file_identity info[MAX_DOS_DRIVES] )
{
+ static pthread_mutex_t cache_mutex = PTHREAD_MUTEX_INITIALIZER;
static struct file_identity cache[MAX_DOS_DRIVES];
static time_t last_update;
static unsigned int nb_drives;
unsigned int ret;
time_t now = time(NULL);
- RtlEnterCriticalSection( &dir_section );
+ pthread_mutex_lock( &cache_mutex );
if (now != last_update)
{
char *buffer, *p;
@@ -1912,7 +1913,7 @@ static unsigned int get_drives_info( struct file_identity info[MAX_DOS_DRIVES] )
}
memcpy( info, cache, sizeof(cache) );
ret = nb_drives;
- RtlLeaveCriticalSection( &dir_section );
+ pthread_mutex_unlock( &cache_mutex );
return ret;
}
More information about the wine-cvs
mailing list