~afrantzis/unity-system-compositor/fix-1491566-deadlock

« back to all changes in this revision

Viewing changes to src/dbus_connection_thread.h

  • Committer: Tarmac
  • Author(s): Andreas Pokorny
  • Date: 2015-09-06 17:45:40 UTC
  • mfrom: (247.3.4 move-dbus-loop)
  • Revision ID: tarmac-20150906174540-ute4opt1d85mn6x9
Move DBusConnection DBusEventLoop and the thread creation to a dedicated structure

This should allow handling more than one interface from the same thread.

Approved by PS Jenkins bot, Alan Griffiths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2015 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef USC_DBUS_CONNECTION_THREAD_H_
 
20
#define USC_DBUS_CONNECTION_THREAD_H_
 
21
 
 
22
#include "dbus_connection_handle.h"
 
23
#include "dbus_event_loop.h"
 
24
 
 
25
#include <thread>
 
26
 
 
27
namespace usc
 
28
{
 
29
 
 
30
class DBusConnectionThread
 
31
{
 
32
public:
 
33
    DBusConnectionThread(std::string const& address);
 
34
    ~DBusConnectionThread();
 
35
    DBusConnectionHandle const& connection() const;
 
36
    DBusEventLoop & loop();
 
37
 
 
38
private:
 
39
    DBusConnectionHandle dbus_connection;
 
40
    DBusEventLoop dbus_event_loop;
 
41
    std::thread dbus_loop_thread;
 
42
};
 
43
 
 
44
}
 
45
 
 
46
#endif