From da7d8cee0fffeebe5490d0a9770e760af0197909 Mon Sep 17 00:00:00 2001
From: Michal Babej <michal.babej@tut.fi>
Date: Thu, 11 Jan 2018 13:17:46 +0100
Subject: [PATCH 14/14] Fix a data race in pocl_runtime_config.c
LL_PREPEND(head, item) changes the head (env_cache) on every call,
which conflicts with other threads calling find_env() with env_cache.
---
lib/CL/pocl_runtime_config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/CL/pocl_runtime_config.c b/lib/CL/pocl_runtime_config.c
index d84ea263..c7000068 100644
--- a/lib/CL/pocl_runtime_config.c
+++ b/lib/CL/pocl_runtime_config.c
@@ -62,7 +62,7 @@ static env_data* find_env (env_data* cache, const char* key)
ed->env = strdup (key);
ed->value = strdup (value);
ed->next = NULL;
- LL_PREPEND(env_cache, ed);
+ LL_APPEND(env_cache, ed);
POCL_UNLOCK(lock);
return ed;
}
--
2.15.1