mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
SDK: Have DDSSession manage $DDS_SESSION_ID
This commit is contained in:
parent
a9b4788756
commit
7aa95fcd93
|
@ -53,25 +53,36 @@ auto operator>>(std::istream& is, DDSRMSPlugin& plugin) -> std::istream&
|
||||||
struct DDSSession::Impl
|
struct DDSSession::Impl
|
||||||
{
|
{
|
||||||
Impl(DDSEnvironment env, DDSRMSPlugin plugin)
|
Impl(DDSEnvironment env, DDSRMSPlugin plugin)
|
||||||
: fEnv(std::move(env))
|
: fCount()
|
||||||
|
, fEnv(std::move(env))
|
||||||
, fDefaultPlugin(std::move(plugin))
|
, fDefaultPlugin(std::move(plugin))
|
||||||
, fSession()
|
, fSession()
|
||||||
, fId(to_string(fSession.create()))
|
, fId(to_string(fSession.create()))
|
||||||
{}
|
{
|
||||||
|
setenv("DDS_SESSION_ID", fId.c_str(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
Impl(DDSEnvironment env, DDSRMSPlugin plugin, Id existing_id)
|
Impl(DDSEnvironment env, DDSRMSPlugin plugin, Id existing_id)
|
||||||
: fEnv(std::move(env))
|
: fCount()
|
||||||
|
, fEnv(std::move(env))
|
||||||
, fDefaultPlugin(std::move(plugin))
|
, fDefaultPlugin(std::move(plugin))
|
||||||
, fSession()
|
, fSession()
|
||||||
, fId(std::move(existing_id))
|
, fId(std::move(existing_id))
|
||||||
{
|
{
|
||||||
fSession.attach(fId);
|
fSession.attach(fId);
|
||||||
|
std::string envId(std::getenv("DDS_SESSION_ID"));
|
||||||
|
if (envId != fId) {
|
||||||
|
setenv("DDS_SESSION_ID", fId.c_str(), 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~Impl()
|
~Impl()
|
||||||
{
|
{
|
||||||
fSession.shutdown();
|
fSession.shutdown();
|
||||||
}
|
}
|
||||||
|
struct Tag {};
|
||||||
|
friend auto operator<<(std::ostream& os, Tag) -> std::ostream& { return os << "DDSSession"; }
|
||||||
|
tools::InstanceLimiter<Tag, 1> fCount;
|
||||||
|
|
||||||
const DDSEnvironment fEnv;
|
const DDSEnvironment fEnv;
|
||||||
const DDSRMSPlugin fDefaultPlugin;
|
const DDSRMSPlugin fDefaultPlugin;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user