Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qautoresetevent_kqueue.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtCore/private/qcore_unix_p.h>
7#include <QtCore/qdebug.h>
8
10
11namespace QtPrivate {
12
14 : QObject{
15 parent,
16 },
18 kqueue(),
19 },
22 this,
23 }
24{
25 if (!isValid()) {
26 qCritical() << "kqueue failed:" << qt_error_string(errno);
27 return;
28 }
29
30 // Register a custom EVFILT_USER event with the EV_CLEAR flag.
31 // The EV_CLEAR flag causes the event to auto-reset once it is delivered.
32 EV_SET(&m_event, 1, EVFILT_USER, EV_ADD | EV_CLEAR, 0, 0, nullptr);
33 if (kevent(m_kqueue.get(), &m_event, 1, nullptr, 0, nullptr) == -1) {
34 qCritical() << "Failed to register EVFILT_USER event:" << qt_error_string(errno);
36 return;
37 }
38
40 struct kevent ev;
41 int nev = kevent(m_kqueue.get(), nullptr, 0, &ev, 1, nullptr);
42 if (nev > 0)
44 });
47}
48
50{
52
53 EV_SET(&m_event, 1, EVFILT_USER, 0, NOTE_TRIGGER, 0, nullptr);
54
55 if (kevent(m_kqueue.get(), &m_event, 1, nullptr, 0, nullptr) == -1)
56 qWarning() << "Failed to signal event";
57}
58
59} // namespace QtPrivate
60
61QT_END_NAMESPACE
62
63#include "moc_qautoresetevent_kqueue_p.cpp"
Combined button and popup list for selecting options.