mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-30 08:03:59 +00:00
parent
597098845c
commit
28e782dda5
@ -89,14 +89,12 @@ static inline void load_stylesheet()
|
||||
}
|
||||
|
||||
|
||||
extern void initialize_qt_core(Genode::Env &);
|
||||
extern void initialize_qt_gui(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qt_core(env);
|
||||
initialize_qt_gui(env);
|
||||
|
||||
int argc = 1;
|
||||
|
@ -75,12 +75,10 @@ class Genode_signal_proxy : public QObject,
|
||||
* Qt initialization
|
||||
*/
|
||||
|
||||
extern void initialize_qt_core(Genode::Env &);
|
||||
extern void initialize_qt_gui(Genode::Env &);
|
||||
|
||||
static inline QApplication & qt5_initialization(Libc::Env &env)
|
||||
{
|
||||
initialize_qt_core(env);
|
||||
initialize_qt_gui(env);
|
||||
|
||||
char const *argv[] = { "qt5_app", 0 };
|
||||
|
@ -7,15 +7,11 @@ CC_WARN = -Wno-unused-but-set-variable -Wno-deprecated-declarations
|
||||
|
||||
include $(REP_DIR)/lib/mk/qt5_core_generated.inc
|
||||
|
||||
# add Genode-specific sources
|
||||
QT_SOURCES += qthread_genode.cpp
|
||||
|
||||
# remove unsupported UNIX-specific files
|
||||
QT_SOURCES_FILTER_OUT = \
|
||||
forkfd_qt.cpp \
|
||||
moc_qfilesystemwatcher_inotify_p.cpp \
|
||||
qfilesystemwatcher_inotify.cpp \
|
||||
qthread_unix.cpp
|
||||
qfilesystemwatcher_inotify.cpp
|
||||
|
||||
# remove unneeded files to prevent moc warnings
|
||||
COMPILER_MOC_HEADER_MAKE_ALL_FILES_FILTER_OUT = \
|
||||
|
@ -1 +1 @@
|
||||
3d6643d8817e3817cf6c80d7a57de698f6eb36b7
|
||||
08438581c2490afe7ced218efdded14505063f7b
|
||||
|
@ -3,7 +3,6 @@ MIRROR_FROM_REP_DIR := lib/mk/qt5_core.mk \
|
||||
lib/mk/qt5_pcre2.mk \
|
||||
lib/mk/qt5_pcre2_generated.inc \
|
||||
lib/mk/qt5.inc \
|
||||
src/lib/qt5/qtbase/src/corelib \
|
||||
src/lib/qt5/libc_dummies.cc \
|
||||
include/libc-plugin \
|
||||
lib/mk/libc_pipe.mk \
|
||||
|
@ -62,14 +62,12 @@ struct Qt_launchpad_namespace::Local_env : Genode::Env
|
||||
}
|
||||
};
|
||||
|
||||
extern void initialize_qt_core(Genode::Env &);
|
||||
extern void initialize_qt_gui(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qt_core(env);
|
||||
initialize_qt_gui(env);
|
||||
|
||||
Qt_launchpad_namespace::Local_env local_env(env);
|
||||
|
@ -164,95 +164,21 @@ index dc0ab9f..a69e088 100644
|
||||
#define QT_USE_MMAP
|
||||
#include "private/qcore_unix_p.h"
|
||||
// for mmap
|
||||
diff --git a/qtbase/src/corelib/thread/qthread.cpp b/qtbase/src/corelib/thread/qthread.cpp
|
||||
index 9f60de1..38bdb38 100644
|
||||
--- a/qtbase/src/corelib/thread/qthread.cpp
|
||||
+++ b/qtbase/src/corelib/thread/qthread.cpp
|
||||
@@ -166,6 +166,10 @@ QThreadPrivate::QThreadPrivate(QThreadData *d)
|
||||
stackSize(0), priority(QThread::InheritPriority), data(d)
|
||||
{
|
||||
diff --git a/qtbase/src/corelib/thread/qthread_unix.cpp b/qtbase/src/corelib/thread/qthread_unix.cpp
|
||||
index ea78b0a..e379c71 100644
|
||||
--- a/qtbase/src/corelib/thread/qthread_unix.cpp
|
||||
+++ b/qtbase/src/corelib/thread/qthread_unix.cpp
|
||||
@@ -93,8 +93,10 @@
|
||||
#endif
|
||||
|
||||
+#ifdef Q_OS_GENODE
|
||||
+ genode_thread = 0;
|
||||
+#endif /* Q_OS_GENODE */
|
||||
+
|
||||
// INTEGRITY doesn't support self-extending stack. The default stack size for
|
||||
// a pthread on INTEGRITY is too small so we have to increase the default size
|
||||
// to 128K.
|
||||
diff --git a/qtbase/src/corelib/thread/qthread_p.h b/qtbase/src/corelib/thread/qthread_p.h
|
||||
index 57e6c99..fd038ec 100644
|
||||
--- a/qtbase/src/corelib/thread/qthread_p.h
|
||||
+++ b/qtbase/src/corelib/thread/qthread_p.h
|
||||
@@ -53,6 +53,10 @@
|
||||
//
|
||||
//
|
||||
|
||||
+#ifdef Q_OS_GENODE
|
||||
+#include <base/thread.h>
|
||||
#if defined(Q_OS_DARWIN) || !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
|
||||
+#ifndef Q_OS_GENODE
|
||||
#define QT_HAS_THREAD_PRIORITY_SCHEDULING
|
||||
#endif
|
||||
+#endif
|
||||
+
|
||||
#include "qplatformdefs.h"
|
||||
#include "QtCore/qthread.h"
|
||||
#include "QtCore/qmutex.h"
|
||||
@@ -179,6 +183,58 @@ public:
|
||||
static QThread *threadForId(int id);
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
+#ifdef Q_OS_GENODE
|
||||
+
|
||||
+ enum { DEFAULT_STACK_SIZE = 4096*100 };
|
||||
+
|
||||
+ class Genode_thread : public Genode::Thread
|
||||
+ {
|
||||
+ private:
|
||||
+
|
||||
+ /*
|
||||
+ * The '_finished_lock' is necessary because 'QThreadPrivate::mutex'
|
||||
+ * uses a 'Genode::Timed_semaphore' internally and it isn't safe
|
||||
+ * to delete a Genode thread that just called 'Semaphore::up()',
|
||||
+ * because the 'Semaphore::_meta_lock' could still be locked.
|
||||
+ */
|
||||
+ Genode::Lock _finished_lock;
|
||||
+ QThread *_qthread;
|
||||
+
|
||||
+ public:
|
||||
+
|
||||
+ Genode_thread(Genode::Env &env, QThread *qthread)
|
||||
+ : Genode::Thread(env, qthread->objectName().toLatin1().constData(), DEFAULT_STACK_SIZE),
|
||||
+ _finished_lock(Genode::Lock::LOCKED),
|
||||
+ _qthread(qthread) { }
|
||||
+
|
||||
+ virtual void entry()
|
||||
+ {
|
||||
+ QThreadPrivate::start(_qthread);
|
||||
+ QThreadPrivate::finish(_qthread);
|
||||
+ _finished_lock.unlock();
|
||||
+ }
|
||||
+
|
||||
+ void join()
|
||||
+ {
|
||||
+ _finished_lock.lock();
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ Genode_thread *genode_thread;
|
||||
+
|
||||
+ struct tls_struct {
|
||||
+ QThreadData *data;
|
||||
+ bool termination_enabled;
|
||||
+ };
|
||||
+
|
||||
+ static Genode::Env *_env;
|
||||
+ static void env(Genode::Env &env) { _env = &env; }
|
||||
+
|
||||
+ static QHash<Qt::HANDLE, struct tls_struct> tls;
|
||||
+
|
||||
+ Qt::HANDLE thread_id;
|
||||
+#endif // Q_OS_GENODE
|
||||
+
|
||||
QWaitCondition thread_done;
|
||||
|
||||
static void *start(void *arg);
|
||||
#if defined(Q_OS_QNX)
|
||||
#include <sys/neutrino.h>
|
||||
diff --git a/qtbase/src/corelib/tools/qdatetime.cpp b/qtbase/src/corelib/tools/qdatetime.cpp
|
||||
index 511dbf0..f1a7216 100644
|
||||
--- a/qtbase/src/corelib/tools/qdatetime.cpp
|
||||
|
@ -20,8 +20,6 @@
|
||||
/* provided by the application */
|
||||
extern "C" int main(int argc, char const **argv);
|
||||
|
||||
void initialize_qt_core(Genode::Env &);
|
||||
|
||||
void initialize_qt_gui(Genode::Env &env) __attribute__((weak));
|
||||
void initialize_qt_gui(Genode::Env &) { }
|
||||
|
||||
@ -29,7 +27,6 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qt_core(env);
|
||||
initialize_qt_gui(env);
|
||||
|
||||
int argc = 1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,14 +12,12 @@
|
||||
/* Qoost includes */
|
||||
#include <qoost/compound_widget.h>
|
||||
|
||||
extern void initialize_qt_core(Genode::Env &);
|
||||
extern void initialize_qt_gui(Genode::Env &);
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qt_core(env);
|
||||
initialize_qt_gui(env);
|
||||
QPluginWidget::env(env);
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
/* provided by the application */
|
||||
extern "C" int main(int argc, char const **argv);
|
||||
|
||||
extern void initialize_qt_core(Genode::Env &);
|
||||
extern void initialize_qt_gui(Genode::Env &);
|
||||
|
||||
/*
|
||||
@ -44,7 +43,6 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
Libc::with_libc([&] {
|
||||
|
||||
initialize_qt_core(env);
|
||||
initialize_qt_gui(env);
|
||||
QPluginWidget::env(env);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user