Skip to content

Commit 242cf99

Browse files
committed
inline constexpr in ThreadStart
1 parent 0dbbfaf commit 242cf99

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/common/ThreadStart.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ class ThreadArgs
7373
Routine routine;
7474
Arg arg;
7575
public:
76-
ThreadArgs(Routine r, Arg a) : routine(r), arg(a) { }
77-
ThreadArgs(const ThreadArgs& t) : routine(t.routine), arg(t.arg) { }
76+
ThreadArgs(Routine r, Arg a) noexcept : routine(r), arg(a) { }
77+
ThreadArgs(const ThreadArgs& t) noexcept : routine(t.routine), arg(t.arg) { }
78+
ThreadArgs& operator=(const ThreadArgs&) = delete;
79+
7880
void run() { routine(arg); }
79-
private:
80-
ThreadArgs& operator=(const ThreadArgs&);
8181
};
8282

8383
#ifdef __cplusplus

src/common/ThreadStart.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040

4141
// Thread priorities (may be ignored)
4242

43-
const int THREAD_high = 1;
44-
const int THREAD_medium_high = 2;
45-
const int THREAD_medium = 3;
46-
const int THREAD_medium_low = 4;
47-
const int THREAD_low = 5;
48-
const int THREAD_critical = 6;
43+
inline constexpr int THREAD_high = 1;
44+
inline constexpr int THREAD_medium_high = 2;
45+
inline constexpr int THREAD_medium = 3;
46+
inline constexpr int THREAD_medium_low = 4;
47+
inline constexpr int THREAD_low = 5;
48+
inline constexpr int THREAD_critical = 6;
4949

5050

5151
// Thread startup
@@ -90,17 +90,14 @@ class Thread
9090
static bool isCurrent(Handle threadHandle);
9191
bool isCurrent();
9292

93-
Thread()
94-
{
95-
memset(&internalId, 0, sizeof(internalId));
96-
}
93+
Thread() noexcept { }
9794

9895
private:
99-
Thread(InternalId iid)
96+
Thread(InternalId iid) noexcept
10097
: internalId(iid)
10198
{ }
10299

103-
InternalId internalId;
100+
InternalId internalId{};
104101
};
105102

106103
inline ThreadId getThreadId()

0 commit comments

Comments
 (0)