Am Sat, 14 Mar 2009 18:25:46 +0300 schrieb Konishchev Dmitry:
> Please, say why dbus-c++ method
> void Connection::request_name(const char *name, int flags)
> has void return type? The return value is very usable to prevent race
> conditions while requesting DBus name. Please, fix this method to
> return dbus_bus_request_name() value.
Hello Dmitry,
I looked into this topic and have seen this in the source:
void Connection::request_name(const char *name, int flags)
{
...
//we deliberately don't check return value
dbus_bus_request_name(_pvt->conn, name, flags, e);
...
}
I've not written this code in Dbus-C++, so I don't understand the
meaning of that comment from the initial author.
For sure I could simply return the int from dbus_bus_request_name(),
but this would break the PImpl concept. This means it's at no place
needed to have <dbus/dbus.h> available for compiling a user application
of DBus-C++. So at least this has to be complete wrapped in some way.
And also the return value of '-1' has to be handled correct. I would
simply throw an Exception for this. But I'm not sure because of the
comment above...
@Paolo: Could you write some comments about this issue?
regards
Andreas
|