# HG changeset patch # User Darkvater # Date 1170334865 0 # Node ID 9601f4469a37a1c65aa23cc669ef32df57475a6c # Parent a5ba89d7f2781d525293b98346bb859560929d89 (svn r8508) -Codechange (r5762): [win32] Use an atomic operation to query and set the value of _global_dir_is_in_use for opendir etc to guarantee concurrency. diff -r a5ba89d7f278 -r 9601f4469a37 src/win32.cpp --- a/src/win32.cpp Thu Feb 01 12:51:10 2007 +0000 +++ b/src/win32.cpp Thu Feb 01 13:01:05 2007 +0000 @@ -625,20 +625,19 @@ /* suballocator - satisfies most requests with a reusable static instance. * this avoids hundreds of alloc/free which would fragment the heap. - * To guarantee reentrancy, we fall back to malloc if the instance is + * To guarantee concurrency, we fall back to malloc if the instance is * already in use (it's important to avoid suprises since this is such a * low-level routine). */ static DIR _global_dir; -static bool _global_dir_is_in_use = false; +static LONG _global_dir_is_in_use = false; static inline DIR *dir_calloc(void) { DIR *d; - if (_global_dir_is_in_use) { + if (InterlockedExchange(&_global_dir_is_in_use, true) == (LONG)true) { d = CallocT