-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
267 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
set(PROJECT_SOURCES | ||
main.cpp | ||
mainwindow.cpp | ||
mainwindow.h | ||
test.h | ||
test.cpp | ||
thread1.h | ||
thread1.cpp | ||
thread2.h | ||
thread2.cpp | ||
thread3.h | ||
thread3.cpp) | ||
functions.cc | ||
functions.hpp | ||
main.cc | ||
task.cc | ||
task.hpp | ||
thread.cc | ||
thread.hpp) | ||
|
||
qt_add_executable(Thread MANUAL_FINALIZATION ${PROJECT_SOURCES}) | ||
target_link_libraries(Thread PRIVATE Qt6::Widgets Qt6::Concurrent) | ||
qt_finalize_executable(Thread) | ||
target_link_libraries(Thread PRIVATE Qt6::Core Qt6::Concurrent) | ||
qt_finalize_executable(Thread) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,26 @@ | ||
QT += core gui concurrent | ||
QT -= gui | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
QT += concurrent | ||
|
||
CONFIG += c++11 | ||
CONFIG += c++17 console | ||
CONFIG -= app_bundle | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any Qt feature that has been marked deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if it uses deprecated APIs. | ||
# You can make your code fail to compile if it uses deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
SOURCES += \ | ||
main.cpp \ | ||
mainwindow.cpp \ | ||
test.cpp \ | ||
thread1.cpp \ | ||
thread2.cpp \ | ||
thread3.cpp | ||
|
||
HEADERS += \ | ||
mainwindow.h \ | ||
test.h \ | ||
thread1.h \ | ||
thread2.h \ | ||
thread3.h | ||
functions.cc \ | ||
main.cc \ | ||
task.cc \ | ||
thread.cc | ||
|
||
# Default rules for deployment. | ||
qnx: target.path = /tmp/$${TARGET}/bin | ||
else: unix:!android: target.path = /opt/$${TARGET}/bin | ||
!isEmpty(target.path): INSTALLS += target | ||
|
||
HEADERS += \ | ||
functions.hpp \ | ||
task.hpp \ | ||
thread.hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "functions.hpp" | ||
|
||
#include <QThread> | ||
|
||
QString Functions::getCurrentThreadIDStr() | ||
{ | ||
return QString("Current Thread ID: %1.") | ||
.arg(reinterpret_cast<qint64>(QThread::currentThreadId())); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef FUNCTIONS_HPP | ||
#define FUNCTIONS_HPP | ||
|
||
#include <QtCore/qglobal.h> | ||
|
||
namespace Functions { | ||
|
||
QString getCurrentThreadIDStr(); | ||
|
||
} | ||
|
||
#endif // FUNCTIONS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <QTimer> | ||
#include <QtCore/QCoreApplication> | ||
|
||
#include "thread.hpp" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QCoreApplication a(argc, argv); | ||
|
||
QScopedPointer<Thread1> t1(new Thread1); | ||
t1->start(); | ||
|
||
QScopedPointer<Thread2> t2(new Thread2); | ||
t2->start(); | ||
QObject::connect(t2.data(), &Thread2::started, t2.data(), &Thread2::onDo); | ||
|
||
QScopedPointer<Thread3> t3(new Thread3); | ||
t3->dooo(); | ||
|
||
runThread4(); | ||
|
||
runThread5(); | ||
|
||
QScopedPointer<QThread> t6(runThread6()); | ||
t6->start(); | ||
|
||
QTimer::singleShot(1000, &a, &QCoreApplication::quit); | ||
|
||
return a.exec(); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.