| 118 | } |
| 119 | |
| 120 | bool ToggleQueue::handle_toggle(Handler handler) { |
| 121 | g_assert(owns_lock() && "Unsafe access to queue"); |
| 122 | |
| 123 | if (q.empty()) |
| 124 | return false; |
| 125 | |
| 126 | const Item& item = q.front(); |
| 127 | if (item.direction == UP) |
| 128 | debug("handle UP", item.object); |
| 129 | else |
| 130 | debug("handle DOWN", item.object); |
| 131 | |
| 132 | handler(item.object, item.direction); |
| 133 | q.pop_front(); |
| 134 | |
| 135 | return true; |
| 136 | } |
| 137 | |
| 138 | void ToggleQueue::shutdown() { |
| 139 | debug("shutdown", nullptr); |