forked from balmerdx/lsignal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlsignal.cpp
More file actions
executable file
·80 lines (60 loc) · 1.03 KB
/
lsignal.cpp
File metadata and controls
executable file
·80 lines (60 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "lsignal.h"
namespace lsignal
{
connection_data::connection_data()
{
}
connection_data::~connection_data()
{
}
connection_cleaner::connection_cleaner()
{
}
connection_cleaner::~connection_cleaner()
{
}
connection::connection()
{
}
connection::connection(std::shared_ptr<connection_data>&& data)
: _data(std::move(data))
{
}
connection::~connection()
{
}
bool connection::is_locked() const
{
return _data->locked;
}
void connection::set_lock(const bool lock)
{
_data->locked = lock;
}
void connection::disconnect()
{
if (_data)
{
//connection fully cleared after next signal call or signal delete
_data->deleted = true;
_data.reset();
}
}
slot::slot()
{
}
slot::~slot()
{
disconnect();
}
void slot::disconnect()
{
decltype(_cleaners) cleaners = _cleaners;
for (auto iter = cleaners.cbegin(); iter != cleaners.cend(); ++iter)
{
const connection_cleaner& cleaner = *iter;
cleaner.data->deleted = true;
}
_cleaners.clear();
}
}//namespace lsignal