~unity-system-compositor-team/unity-system-compositor/ubuntu

« back to all changes in this revision

Viewing changes to src/dbus_connection_thread.cpp

  • Committer: CI Train Bot
  • Author(s): CI Train Bot, Kevin DuBois, Alexandros Frantzis
  • Date: 2016-01-21 17:58:56 UTC
  • mfrom: (200.45.12 0.3)
  • Revision ID: ci-train-bot@canonical.com-20160121175856-m9rosowob03a105o
ReleaseĀ 0.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
#include "dbus_connection_thread.h"
 
20
#include "dbus_event_loop.h"
20
21
#include "thread_name.h"
21
22
 
22
 
usc::DBusConnectionThread::DBusConnectionThread(std::string const& address)
23
 
    : dbus_connection{address.c_str()},
24
 
      dbus_event_loop{dbus_connection}
 
23
usc::DBusConnectionThread::DBusConnectionThread(std::shared_ptr<DBusEventLoop> const& loop) : dbus_event_loop(loop)
25
24
{
26
25
    std::promise<void> event_loop_started;
27
26
    auto event_loop_started_future = event_loop_started.get_future();
30
29
        [this,&event_loop_started]
31
30
        {
32
31
            usc::set_thread_name("USC/DBus");
33
 
            dbus_event_loop.run(event_loop_started);
 
32
            dbus_event_loop->run(event_loop_started);
34
33
        });
35
34
 
36
35
    event_loop_started_future.wait();
38
37
 
39
38
usc::DBusConnectionThread::~DBusConnectionThread()
40
39
{
41
 
    dbus_event_loop.stop();
 
40
    dbus_event_loop->stop();
42
41
    dbus_loop_thread.join();
43
42
}
44
43
 
45
 
usc::DBusConnectionHandle const& usc::DBusConnectionThread::connection() const
46
 
{
47
 
    return dbus_connection;
48
 
}
49
 
 
50
44
usc::DBusEventLoop & usc::DBusConnectionThread::loop()
51
45
{
52
 
    return dbus_event_loop;
 
46
    return *dbus_event_loop;
53
47
}