MEDIUM: 51d: Enabled multi threaded operation in the 51Degrees module.
The existing threading flag in the 51Degrees API
(FIFTYONEDEGREES_NO_THREADING) has now been mapped to the HAProxy
threading flag (USE_THREAD), and the 51Degrees module code has been made
thread safe.
In Pattern, the cache is now locked with a spin lock from hathreads.h
using a new lable 'OTHER_LOCK'. The workset pool is now created with the
same size as the number of threads to avoid any time waiting on a
worket.
In Hash Trie, the global device offsets structure is only used in single
threaded operation. Multi threaded operation creates a new offsets
structure in each thread.
diff --git a/include/common/hathreads.h b/include/common/hathreads.h
index 6f78876..e4603a5 100644
--- a/include/common/hathreads.h
+++ b/include/common/hathreads.h
@@ -416,6 +416,7 @@
START_LOCK,
TLSKEYS_REF_LOCK,
AUTH_LOCK,
+ OTHER_LOCK,
LOCK_LABELS
};
struct lock_stat {
@@ -532,6 +533,7 @@
case START_LOCK: return "START";
case TLSKEYS_REF_LOCK: return "TLSKEYS_REF";
case AUTH_LOCK: return "AUTH";
+ case OTHER_LOCK: return "OTHER";
case LOCK_LABELS: break; /* keep compiler happy */
};
/* only way to come here is consecutive to an internal bug */