null+****@clear*****
null+****@clear*****
2012年 3月 21日 (水) 11:25:44 JST
Susumu Yata 2012-03-21 11:25:44 +0900 (Wed, 21 Mar 2012)
New Revision: a8e62c800afdd77d67a3260ef438810e7f72a578
Log:
Print error message when pthread_join() fails.
Modified files:
src/suggest/groonga_suggest_httpd.c
src/suggest/groonga_suggest_learner.c
Modified: src/suggest/groonga_suggest_httpd.c (+7 -3)
===================================================================
--- src/suggest/groonga_suggest_httpd.c 2012-03-21 11:24:13 +0900 (5e211ae)
+++ src/suggest/groonga_suggest_httpd.c 2012-03-21 11:25:44 +0900 (eb3e194)
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2010-2011 Brazil
+/* Copyright(C) 2010-2012 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -632,7 +632,9 @@ serve_threads(int nthreads, int port, const char *db_path, void *zmq_ctx,
if (pthread_create(&(rthd.thd), NULL, recv_from_learner, &rthd)) {
print_error("error in pthread_create() on thread %d.", i);
}
- pthread_join(rthd.thd, NULL);
+ if (pthread_join(rthd.thd, NULL)) {
+ print_error("error in pthread_join() on thread %d.", i);
+ }
} else {
while (loop) { sleep(1000); }
}
@@ -640,7 +642,9 @@ serve_threads(int nthreads, int port, const char *db_path, void *zmq_ctx,
/* join all httpd thread */
for (i = 0; i < nthreads; i++) {
if (threads[i].thd) {
- pthread_join(threads[i].thd, NULL);
+ if (pthread_join(threads[i].thd, NULL)) {
+ print_error("error in pthread_join() on thread %d.", i);
+ }
}
cleanup_httpd_thread(&(threads[i]));
}
Modified: src/suggest/groonga_suggest_learner.c (+4 -2)
===================================================================
--- src/suggest/groonga_suggest_learner.c 2012-03-21 11:24:13 +0900 (7e714d9)
+++ src/suggest/groonga_suggest_learner.c 2012-03-21 11:25:44 +0900 (042d710)
@@ -1,5 +1,5 @@
/* -*- c-basic-offset: 2 -*- */
-/* Copyright(C) 2010- Brazil
+/* Copyright(C) 2010-2012 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -767,7 +767,9 @@ main(int argc, char **argv)
print_error("error in pthread_create() for sending datas.");
}
recv_event_loop(mempool, zmq_recv_sock, ctx);
- pthread_join(thd.thd, NULL);
+ if (pthread_join(thd.thd, NULL)) {
+ print_error("error in pthread_join() for waiting completion of sending data.");
+ }
}
zmq_term(zmq_ctx);
}