File tree 2 files changed +17
-13
lines changed
2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -116,9 +116,7 @@ bool Thread::start()
116
116
#if USE_CPP11_THREADS
117
117
118
118
try {
119
- m_thread_obj = new std::thread (threadProc, this );
120
- m_thread_id = m_thread_obj->get_id ();
121
- m_thread_handle = m_thread_obj->native_handle ();
119
+ m_thread_obj = new std::thread (threadProc, this );
122
120
} catch (const std::system_error &e) {
123
121
return false ;
124
122
}
@@ -135,8 +133,6 @@ bool Thread::start()
135
133
if (status)
136
134
return false ;
137
135
138
- m_thread_id = m_thread_handle;
139
-
140
136
#endif
141
137
142
138
while (!m_running)
@@ -234,12 +230,6 @@ bool Thread::getReturnValue(void **ret)
234
230
}
235
231
236
232
237
- bool Thread::isCurrentThread ()
238
- {
239
- return thr_is_current_thread (m_thread_id);
240
- }
241
-
242
-
243
233
#if USE_CPP11_THREADS || USE_POSIX_THREADS
244
234
void *Thread::threadProc (void *param)
245
235
#elif defined(_WIN32_WCE)
Original file line number Diff line number Diff line change @@ -90,12 +90,22 @@ class Thread {
90
90
/*
91
91
* Returns true if the calling thread is this Thread object.
92
92
*/
93
- bool isCurrentThread ();
93
+ bool isCurrentThread () { return thr_is_current_thread ( getThreadId ()); }
94
94
95
95
inline bool isRunning () { return m_running; }
96
96
inline bool stopRequested () { return m_request_stop; }
97
+
98
+ #if USE_CPP11_THREADS
99
+ inline threadid_t getThreadId () { return m_thread_obj->get_id (); }
100
+ inline threadhandle_t getThreadHandle () { return m_thread_obj->native_handle (); }
101
+ #else
102
+ # if USE_WIN_THREADS
97
103
inline threadid_t getThreadId () { return m_thread_id; }
104
+ # else
105
+ inline threadid_t getThreadId () { return m_thread_handle; }
106
+ # endif
98
107
inline threadhandle_t getThreadHandle () { return m_thread_handle; }
108
+ #endif
99
109
100
110
/*
101
111
* Gets the thread return value.
@@ -147,8 +157,12 @@ class Thread {
147
157
Atomic<bool > m_running;
148
158
Mutex m_mutex;
149
159
150
- threadid_t m_thread_id;
160
+ # if !USE_CPP11_THREADS
151
161
threadhandle_t m_thread_handle;
162
+ #if _WIN32
Has a conversation. Original line has a conversation.
163
+ threadid_t m_thread_id;
164
+ #endif
165
+ #endif
152
166
153
167
static ThreadStartFunc threadProc;
154
168
You can’t perform that action at this time.