MCPcopy Create free account
hub / github.com/acl-dev/acl / wait

Method wait

lib_acl_cpp/src/stdlib/thread.cpp:151–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151bool thread::wait(void** out /* = NULL */)
152{
153 if (detachable_) {
154 logger_error("detachable thread can't be wait!");
155 return false;
156 }
157
158 wait_for_running();
159
160 if (thread_id_ == 0) {
161 logger_error("thread not running!");
162 return false;
163 }
164
165 void* ptr;
166
167#ifdef ACL_WINDOWS
168 int ret = acl_pthread_join(*((acl_pthread_t*) thread_), &ptr);
169#else
170 int ret = acl_pthread_join(thread_, &ptr);
171#endif
172
173 if (ret != 0) {
174 acl_set_error(ret);
175 logger_error("pthread_join error: %s", last_serror());
176 return false;
177 }
178
179 // �Ƚ�ͨ���� thread_run �нػ�IJ����� pthread_join ��õIJ����Ƿ���ͬ
180 if (ptr != return_arg_) {
181 logger_warn("pthread_josin's arg invalid?");
182 }
183
184 if (out) {
185 *out = ptr;
186 }
187 return true;
188}
189
190unsigned long thread::thread_id() const
191{

Callers 15

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
test_redis_sessionFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 3

acl_pthread_joinFunction · 0.85
acl_set_errorFunction · 0.85
last_serrorFunction · 0.70

Tested by 3

test_redis_sessionFunction · 0.36
test_threadFunction · 0.36
test_thread3Function · 0.36