Skip to content

Commit 02a2c95

Browse files
fix compilation errors on mac
1 parent c63987a commit 02a2c95

12 files changed

Lines changed: 35 additions & 34 deletions

src/corelib.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,6 @@ HEADERS += tactioncontextroutine.h
354354
SOURCES += tactioncontextroutine.cpp
355355
# HEADERS += tthreadpool.h
356356
# SOURCES += tthreadpool.cpp
357-
HEADERS += tthreadpoolawaiter.h
358-
SOURCES += tthreadpoolawaiter.cpp
359357

360358
!wasm {
361359
HEADERS += tsmtpmailer.h
@@ -409,6 +407,8 @@ linux-* {
409407
SOURCES += turingcoroutine_linux.cpp
410408
HEADERS += tactionworker.h
411409
SOURCES += tactionworker.cpp
410+
HEADERS += tthreadpoolawaiter.h
411+
SOURCES += tthreadpoolawaiter.cpp
412412
# HEADERS += tactionroutine.h
413413
# SOURCES += tactionroutine.cpp
414414
HEADERS += tepoll.h

src/tdatabasecontext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ TSqlDatabase &TDatabaseContext::getSqlDatabase(int id)
7171
int n = 0;
7272
do {
7373
if (!handle || !handle->isValid()) {
74-
handle = std::move(TSqlDatabasePool::instance()->database(id));
74+
handle = TSqlDatabasePool::instance()->database(id);
7575
}
7676

7777
if (tx.begin()) {
7878
break;
7979
}
8080

81-
handle = std::move(TSqlDatabase::Handle{});
81+
handle = TSqlDatabase::Handle{};
8282
} while (++n < 2); // try two times
8383

8484
idleElapsed = (uint)std::time(nullptr);
@@ -102,7 +102,7 @@ TKvsDatabase::Handle &TDatabaseContext::getKvsDatabase(Tf::KvsEngine engine)
102102
{
103103
auto &handle = kvsDatabases[(int)engine];
104104
if (!handle || !handle->isValid()) {
105-
handle = std::move(TKvsDatabasePool::instance()->database(engine));
105+
handle = TKvsDatabasePool::instance()->database(engine);
106106
}
107107

108108
idleElapsed = (uint)std::time(nullptr);

src/test/sharedmemorymutex/sharedmemorymutex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "tsharedmemorykvs.h"
44
#include "tcommandlineinterface.h"
55
#include "tglobal.h"
6+
#include <thread>
67

78

89
const QString SHM_NAME = "tfcache.shm";

src/thazardobject.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ class T_CORE_EXPORT THazardObject {
77
public:
88
THazardObject();
99
THazardObject(const THazardObject &);
10-
THazardObject(THazardObject &&) = default;
10+
THazardObject &operator=(const THazardObject &) { return *this; }
11+
THazardObject(THazardObject &&) = delete;
12+
THazardObject &operator=(THazardObject &&) = delete;
1113
virtual ~THazardObject() { }
1214

1315
void deleteLater();
14-
THazardObject &operator=(const THazardObject &) { return *this; }
15-
THazardObject &operator=(THazardObject &&) { return *this; }
1616

1717
private:
1818
THazardObject *next {nullptr};

src/thttprequest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ THttpRequest::THttpRequest(const THttpRequestHeader &header, const QByteArray &b
8787
THttpRequest::THttpRequest(const QByteArray &header, const QString &filePath, const QHostAddress &clientAddress, TActionContext *context) :
8888
d(std::make_unique<THttpRequestData>())
8989
{
90-
d->header = std::move(THttpRequestHeader{header});
90+
d->header = THttpRequestHeader{header};
9191
d->clientAddress = clientAddress;
9292

9393
if (d->header.contentType().trimmed().toLower().startsWith(QByteArrayLiteral("multipart/form-data"))) {

src/tkvsdatabase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TKvsDatabaseDict : public QMap<QString, TKvsDatabaseSettings> {
3535

3636
static TKvsDatabaseDict *databaseDict()
3737
{
38-
static std::unique_ptr<TKvsDatabaseDict> dict{new TKvsDatabaseDict{}};
38+
static std::unique_ptr<TKvsDatabaseDict> dict = std::make_unique<TKvsDatabaseDict>();
3939
return dict.get();
4040
}
4141

src/tmongoquery.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ class TMongoDriver;
1010
class T_CORE_EXPORT TMongoQuery {
1111
public:
1212
TMongoQuery(const QString &collection);
13-
//TMongoQuery(const TMongoQuery &other);
14-
TMongoQuery(TMongoQuery &&) = default;
1513
virtual ~TMongoQuery() { }
16-
TMongoQuery &operator=(TMongoQuery &&) = default;
14+
TMongoQuery(const TMongoQuery &) = delete;
15+
TMongoQuery &operator=(const TMongoQuery &) = delete;
16+
TMongoQuery(TMongoQuery &&) = delete;
17+
TMongoQuery &operator=(TMongoQuery &&) = delete;
1718

1819
int limit() const;
1920
void setLimit(int limit);
@@ -35,8 +36,6 @@ class T_CORE_EXPORT TMongoQuery {
3536
int count(const QVariantMap &criteria = QVariantMap());
3637
QString lastErrorString() const;
3738

38-
//TMongoQuery &operator=(const TMongoQuery &other);
39-
4039
private:
4140
TMongoDriver *driver();
4241
const TMongoDriver *driver() const;
@@ -50,7 +49,6 @@ class T_CORE_EXPORT TMongoQuery {
5049
int _queryOffset {0};
5150

5251
friend class TCacheMongoStore;
53-
T_DISABLE_COPY(TMongoQuery)
5452
};
5553

5654

src/tthreadapplicationserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
an web application server for thread.
1818
*/
1919

20-
TLockStack<TActionThread *> &TThreadApplicationServer::threadPoolPtr()
20+
TLockStack<TActionThread *> &TThreadApplicationServer::threadPool()
2121
{
2222
static TLockStack<TActionThread *> threadPool;
2323
return threadPool;

src/tthreadapplicationserver.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ class T_CORE_EXPORT TThreadApplicationServer : public QTcpServer, public TApplic
1919
void stop() override;
2020
void setAutoReloadingEnabled(bool enable) override;
2121
bool isAutoReloadingEnabled() override;
22+
static TThreadApplicationServer *instance(int listeningSocket = 0, QObject *parent = nullptr);
2223

2324
protected:
2425
void incomingConnection(qintptr socketDescriptor) override;
2526
void timerEvent(QTimerEvent *event) override;
2627

2728
private:
28-
static TLockStack<TActionThread *> *threadPoolPtr();
29+
static TLockStack<TActionThread *> &threadPool();
2930

3031
int listenSocket {0};
3132
int maxThreads {0};
@@ -44,15 +45,15 @@ class T_CORE_EXPORT TThreadApplicationServer : public QThread, public TApplicati
4445
void stop() override;
4546
void setAutoReloadingEnabled(bool enable) override;
4647
bool isAutoReloadingEnabled() override;
47-
static TThreadApplicationServer *instance(int listeningSocket = 0,QObject *parent = nullptr);
48+
static TThreadApplicationServer *instance(int listeningSocket = 0, QObject *parent = nullptr);
4849

4950
protected:
5051
void incomingConnection(qintptr socketDescriptor);
5152
void timerEvent(QTimerEvent *event) override;
5253
void run() override;
5354

5455
private:
55-
static TLockStack<TActionThread *> &threadPoolPtr();
56+
static TLockStack<TActionThread *> &threadPool();
5657
TThreadApplicationServer(int listeningSocket, QObject *parent = nullptr);
5758

5859
int listenSocket {0};

src/tthreadapplicationserver_linux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ TThreadApplicationServer::TThreadApplicationServer(int listeningSocket, QObject
3333
for (int i = 0; i < maxThreads; i++) {
3434
TActionThread *thread = new TActionThread(0);
3535
connect(thread, &TActionThread::finished, [=]() {
36-
threadPoolPtr().push(thread);
36+
threadPool().push(thread);
3737
});
38-
threadPoolPtr().push(thread);
38+
threadPool().push(thread);
3939
}
4040
}
4141

@@ -110,7 +110,7 @@ void TThreadApplicationServer::run()
110110
tSystemDebug("incomingConnection sd:{} thread count:{} max:{}", socketDescriptor, TActionThread::threadCount(), maxThreads);
111111
std::optional<TActionThread*> thread;
112112

113-
while (!(thread = threadPoolPtr().pop())) {
113+
while (!(thread = threadPool().pop())) {
114114
std::this_thread::yield();
115115
Tf::msleep(1);
116116
}

0 commit comments

Comments
 (0)