Make default context thread_local (#286)
* Make default context thread_local Signed-off-by: Ben Magistro <koncept1@gmail.com> Co-authored-by: Vincent Richard <vincent@vincent-richard.net>
This commit is contained in:
parent
1a35bb6d71
commit
6e11c9c9f8
@ -42,7 +42,7 @@ parsingContext::parsingContext(const parsingContext& ctx)
|
|||||||
|
|
||||||
parsingContext& parsingContext::getDefaultContext() {
|
parsingContext& parsingContext::getDefaultContext() {
|
||||||
|
|
||||||
static parsingContext ctx;
|
static thread_local parsingContext ctx;
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,12 @@ struct headerParseRecoveryMethod {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Holds configuration parameters used for parsing messages.
|
/** 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 {
|
class VMIME_EXPORT parsingContext : public context {
|
||||||
|
|
||||||
@ -50,9 +56,10 @@ public:
|
|||||||
parsingContext();
|
parsingContext();
|
||||||
parsingContext(const parsingContext& ctx);
|
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();
|
static parsingContext& getDefaultContext();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user