Skip to content
Snippets Groups Projects
Commit 61c9007c authored by Tim Wickberg's avatar Tim Wickberg
Browse files

Clear thread-lock lock structure on unlock.

And mark thread local variables static to limit scope.
parent c38bea15
No related branches found
No related tags found
No related merge requests found
...@@ -67,14 +67,14 @@ static void _wr_wrunlock(lock_datatype_t datatype); ...@@ -67,14 +67,14 @@ static void _wr_wrunlock(lock_datatype_t datatype);
* systems. Only used within development builds to mitigate possible problems * systems. Only used within development builds to mitigate possible problems
* with production builds. * with production builds.
*/ */
__thread bool slurmctld_locked = false; static __thread bool slurmctld_locked = false;
/* /*
* Used to detect any location where the acquired locks differ from the * Used to detect any location where the acquired locks differ from the
* release locks. * release locks.
*/ */
__thread slurmctld_lock_t thread_locks; static __thread slurmctld_lock_t thread_locks;
static bool _store_locks(slurmctld_lock_t lock_levels) static bool _store_locks(slurmctld_lock_t lock_levels)
{ {
...@@ -94,8 +94,13 @@ static bool _clear_locks(slurmctld_lock_t lock_levels) ...@@ -94,8 +94,13 @@ static bool _clear_locks(slurmctld_lock_t lock_levels)
return false; return false;
slurmctld_locked = false; slurmctld_locked = false;
return !memcmp((void *) &thread_locks, (void *) &lock_levels, if (memcmp((void *) &thread_locks, (void *) &lock_levels,
sizeof(slurmctld_lock_t)); sizeof(slurmctld_lock_t)))
return false;
memset((void *) &thread_locks, 0, sizeof(slurmctld_lock_t));
return true;
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment