Commit Graph

3 Commits

Author SHA1 Message Date
Andrew Johnson
345f2782cd caContext: Restore existing context in constructor
Don't assume other code might be using our context.
Fix destructor to reattach the right context.
2021-01-05 11:01:02 -08:00
Andrew Johnson
92002b6ba2 Include pvAccess.h before exportSharedSym's in caContext.cpp 2021-01-05 11:01:02 -08:00
Andrew Johnson
f9c40e96cf Collect ca_client_context operations
Each instance of the caContext class represents a separate CA context,
so each CAChannelProvider creates one and keeps a shared_ptr to it,
making that available to its channels and channel operations. These
also take their own shared_ptr to it as well so the context cannot be
destroyed while it might be needed.

A related caContext Attach object is intended to be short-lived, and
to be allocated on the stack. When created it saves the current CA
context for the thread, replacing it from the caContext given to its
constructor. CA operations will now use the attached context. When the
Attach destructor runs it detaches the thread from the current context
(checking still has the expected value) and re-attaches the thread to
any context that was saved by the constructor.
2021-01-05 11:01:02 -08:00