aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbmagistro <[email protected]>2023-12-31 14:19:28 +0000
committerGitHub <[email protected]>2023-12-31 14:19:28 +0000
commit6e11c9c9f817ee37da4ccfa5f50d2cca71de949e (patch)
tree982f411b8f04ad7d2271f5507a1a6d0127f19a88 /src
parentBuild: add Solaris compilation support (#282) (diff)
downloadvmime-6e11c9c9f817ee37da4ccfa5f50d2cca71de949e.tar.gz
vmime-6e11c9c9f817ee37da4ccfa5f50d2cca71de949e.zip
Make default context thread_local (#286)
* Make default context thread_local Signed-off-by: Ben Magistro <[email protected]> Co-authored-by: Vincent Richard <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/vmime/parsingContext.cpp2
-rw-r--r--src/vmime/parsingContext.hpp11
2 files changed, 10 insertions, 3 deletions
diff --git a/src/vmime/parsingContext.cpp b/src/vmime/parsingContext.cpp
index 0975e3d7..2ffdfa87 100644
--- a/src/vmime/parsingContext.cpp
+++ b/src/vmime/parsingContext.cpp
@@ -42,7 +42,7 @@ parsingContext::parsingContext(const parsingContext& ctx)
parsingContext& parsingContext::getDefaultContext() {
- static parsingContext ctx;
+ static thread_local parsingContext ctx;
return ctx;
}
diff --git a/src/vmime/parsingContext.hpp b/src/vmime/parsingContext.hpp
index d13d94ef..1107fd57 100644
--- a/src/vmime/parsingContext.hpp
+++ b/src/vmime/parsingContext.hpp
@@ -42,6 +42,12 @@ struct headerParseRecoveryMethod {
};
/** Holds configuration parameters used for parsing messages.
+ *
+ * Within vmime there are some functions that only utilize the default parsing
+ * context. If you need to manipulate the behavior of the parser for those
+ * functions, it is suggested to get the default context and make the
+ * appropriate set calls to adjust the behavior. You can also use this
+ * instance when making function calls the require a context be passed in.
*/
class VMIME_EXPORT parsingContext : public context {
@@ -50,9 +56,10 @@ public:
parsingContext();
parsingContext(const parsingContext& ctx);
- /** Returns the default context used for parsing messages.
+ /** Returns the default context used for parsing messages. The context
+ * is scoped as a thread local variable.
*
- * @return a reference to the default parsing context
+ * @return a reference to the default parsing context for that thread
*/
static parsingContext& getDefaultContext();