sdbusplus:多线程共享同一个bus,做同步调用,行为未定义

//add_service1.cpp
#include 
#include 
#include 
#include 
#include 
 
using namespace std;
 
int addInt(int d1, int d2)
{
    return d1 + d2;
}
 
string addString(string s1, string s2)
{
    return s1 + s2;
}
 
int main()
{
    boost::asio::io_context io;
    auto conn = std::make_shared(io);
    conn->request_name("calculate1.service");
    auto server = sdbusplus::asio::object_server(conn);
    shared_ptr iface = server.add_interface("/calculate_obj","calculate_infterface.data");
    iface->register_method("AddInt", addInt);
    iface->register_method("AddString", addString);
    iface->register_property("data", 18, sdbusplus::asio::PropertyPermission::readWrite);
    if

你可能感兴趣的:(Sdbusplus,linux)