aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/win32/sys_env.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2011-10-09 00:03:14 +0200
committerRickard Green <[email protected]>2011-11-13 20:40:58 +0100
commitdcc7ecbf6af5420af2d5dbd0e97fc7a2e0e894a6 (patch)
tree36335364e0e2ece36709ae73bf57f1d1d1b4b211 /erts/emulator/sys/win32/sys_env.c
parent933790021e5fa95e4e6242e3f2eb2fcf64666a57 (diff)
downloadotp-dcc7ecbf6af5420af2d5dbd0e97fc7a2e0e894a6.tar.gz
otp-dcc7ecbf6af5420af2d5dbd0e97fc7a2e0e894a6.tar.bz2
otp-dcc7ecbf6af5420af2d5dbd0e97fc7a2e0e894a6.zip
Use generic lock-free queue for async threads
Queues used for communication between async threads and scheduler threads have been replaced with lock-free queues. Drivers using the driver_async functionality are not automatically locked to the system anymore, and can be unloaded as any dynamically linked in driver. Scheduling of ready async jobs is now also interleaved in between other jobs. Previously all ready async jobs was performed at once.
Diffstat (limited to 'erts/emulator/sys/win32/sys_env.c')
-rw-r--r--erts/emulator/sys/win32/sys_env.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/erts/emulator/sys/win32/sys_env.c b/erts/emulator/sys/win32/sys_env.c
index 02c8433a10..7acc7f07ee 100644
--- a/erts/emulator/sys/win32/sys_env.c
+++ b/erts/emulator/sys/win32/sys_env.c
@@ -55,19 +55,17 @@ erts_sys_putenv(char *key_value, int sep_ix)
}
int
-erts_sys_getenv(char *key, char *value, size_t *size)
+erts_sys_getenv__(char *key, char *value, size_t *size)
{
size_t req_size = 0;
int res = 0;
DWORD new_size;
- erts_smp_rwmtx_rlock(&environ_rwmtx);
SetLastError(0);
new_size = GetEnvironmentVariable((LPCTSTR) key,
(LPTSTR) value,
(DWORD) *size);
res = !new_size && GetLastError() == ERROR_ENVVAR_NOT_FOUND ? -1 : 0;
- erts_smp_rwmtx_runlock(&environ_rwmtx);
if (res < 0)
return res;
res = new_size > *size ? 1 : 0;
@@ -75,6 +73,16 @@ erts_sys_getenv(char *key, char *value, size_t *size)
return res;
}
+int
+erts_sys_getenv(char *key, char *value, size_t *size)
+{
+ int res;
+ erts_smp_rwmtx_rlock(&environ_rwmtx);
+ res = erts_sys_getenv__(key, value, size);
+ erts_smp_rwmtx_runlock(&environ_rwmtx);
+ return res;
+}
+
struct win32_getenv_state {
char *env;
char *next;