[Merge] lp:~ssweeny/location-service/async-providers.15.04 into lp:location-service/15.04

Thomas Voß thomas.voss at canonical.com
Tue Dec 1 20:13:01 UTC 2015


Review: Needs Fixing

Thanks for the changes, a remark inline.

Diff comments:

> 
> === modified file 'src/location_service/com/ubuntu/location/providers/remote/provider.cpp'
> --- src/location_service/com/ubuntu/location/providers/remote/provider.cpp	2015-04-14 18:54:00 +0000
> +++ src/location_service/com/ubuntu/location/providers/remote/provider.cpp	2015-12-01 14:48:11 +0000
> @@ -191,6 +192,24 @@
>      auto service = dbus::Service::use_service(bus, name);
>      auto object = service->object_for_path(path);
>  
> +    // Check if the service has come up
> +    if (!bus->has_owner_for_name(name)) {
> +        // If it hasn't wait for it to come up
> +        bool valid = false;
> +        dbus::DBus daemon(bus);
> +        dbus::ServiceWatcher::Ptr service_watcher(
> +            daemon.make_service_watcher(name, dbus::DBus::WatchMode::registration));
> +
> +        service_watcher->service_registered().connect([&valid]()

Instead of busy waiting in the while loop later on, we can easily leverage a condition_variable as in http://pastebin.ubuntu.com/13605139/

> +            {
> +                valid = true;
> +            });
> +
> +        while (!valid) {
> +            continue;
> +        }
> +    }
> +
>      return create_instance_with_config(remote::stub::Configuration{object});
>  }
>  


-- 
https://code.launchpad.net/~ssweeny/location-service/async-providers.15.04/+merge/278092
Your team Ubuntu Phablet Team is subscribed to branch lp:location-service/15.04.



More information about the Ubuntu-reviews mailing list