← Back to team overview

nrtb-core team mailing list archive

[Merge] lp:~fpstovall/nrtb/unique-ptr-msg-fix into lp:nrtb

 

Rick Stovall has proposed merging lp:~fpstovall/nrtb/unique-ptr-msg-fix into lp:nrtb.

Requested reviews:
  NRTB Core (nrtb-core): code

For more details, see:
https://code.launchpad.net/~fpstovall/nrtb/unique-ptr-msg-fix/+merge/101179

1. Completed required changes to make the entire nrtb::common library be C++11 compliant. All builds use the -std::gnu++0x switch and everything has been unit tested and seems clean.

2. Significant cleanups to the nrtb::tcp_server_socket_factory to improve error detection and reporting on startup and to remove the occasional segfault which would occur during program shutdown. tcp_server_socket_factory is now much more robust and should behave properly even on slower machines.

NOTE: we are still using the old style thread library... I anticipate upgrading threads after alpha goals are met.

Rick intends to merge this branch to the main stream Monday night, 2012-04-09 unless serious objections are raised... further work on the communications layer is dependent on these updates.
-- 
https://code.launchpad.net/~fpstovall/nrtb/unique-ptr-msg-fix/+merge/101179
Your team NRTB Core is requested to review the proposed merge of lp:~fpstovall/nrtb/unique-ptr-msg-fix into lp:nrtb.
=== modified file 'common/GPB/Makefile'
--- common/GPB/Makefile	2011-07-22 02:58:56 +0000
+++ common/GPB/Makefile	2012-04-07 14:48:19 +0000
@@ -23,7 +23,7 @@
 
 lib/nrtb_gpb.a:
 	@protoc -I=${proto} --cpp_out=cpp_src/ ${proto}/*.proto
-	@cd obj; for file in ../cpp_src/*.cc; do g++ -c $$file; done
+	@cd obj; for file in ../cpp_src/*.cc; do g++ -c $$file -std=gnu++0x; done
 	@cp -v cpp_src/*h ../include
 	@ar -r ../lib/nrtb_gpb.a obj/*.o
 

=== modified file 'common/circular_queue/Makefile'
--- common/circular_queue/Makefile	2011-10-06 20:09:07 +0000
+++ common/circular_queue/Makefile	2012-04-07 14:48:19 +0000
@@ -23,8 +23,8 @@
 
 circular_queue_test:	circular_queue.h circular_queue_test.cpp
 	@rm -f circular_queue_test
-	g++ -c circular_queue_test.cpp -I../include
-	g++ -o circular_queue_test circular_queue_test.o ../obj/common.o ../obj/base_thread.o -lpthread 
+	g++ -c circular_queue_test.cpp -I../include -std=gnu++0x
+	g++ -o circular_queue_test circular_queue_test.o ../obj/common.o ../obj/base_thread.o -lpthread  -std=gnu++0x
 
 clean:
 	@rm -rvf *.o circular_queue_test ../include/circular_queue.h *.log ../obj/circular_queue.o

=== modified file 'common/comm_handlers/ack_nak/Makefile'
--- common/comm_handlers/ack_nak/Makefile	2011-12-20 01:44:44 +0000
+++ common/comm_handlers/ack_nak/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 ack_nak_test:	ack_nak.o ack_nak_test.cpp
 	@rm -f ack_nak_test
-	g++ -c ack_nak_test.cpp -I ../../include -I ../include
-	g++ -o ack_nak_test ack_nak_test.o ack_nak.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c ack_nak_test.cpp -I ../../include -I ../include -std=gnu++0x 
+	g++ -o ack_nak_test ack_nak_test.o ack_nak.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x 
 
 ack_nak.o:	ack_nak.cpp ack_nak.h Makefile
 	@rm -f ack_nak.o
-	g++ -c -O3 ack_nak.cpp -I ../include -I ../../include
+	g++ -c -O3 ack_nak.cpp -I ../include -I ../../include -std=gnu++0x 
 
 clean:
 	@rm -vf *.o ../include/ack_nak.h ../obj/ack_nak.o ack_nak_test

=== modified file 'common/comm_handlers/location_data/Makefile'
--- common/comm_handlers/location_data/Makefile	2011-12-14 16:39:02 +0000
+++ common/comm_handlers/location_data/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 location_data_test:	location_data.o location_data_test.cpp
 	@rm -f location_data_test
-	g++ -c location_data_test.cpp -I ../../include -I ../include
-	g++ -o location_data_test location_data_test.o location_data.o ../obj/triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c location_data_test.cpp -I ../../include -I ../include -std=gnu++0x 
+	g++ -o location_data_test location_data_test.o location_data.o ../obj/triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x 
 
 location_data.o:	location_data.cpp location_data.h Makefile
 	@rm -f location_data.o
-	g++ -c -O3 location_data.cpp -I ../include -I../../include
+	g++ -c -O3 location_data.cpp -I ../include -I../../include -std=gnu++0x 
 
 clean:
 	@rm -vf *.o ../include/location_data.h ../obj/location_data.o location_data_test

=== modified file 'common/comm_handlers/obj_setup_info/Makefile'
--- common/comm_handlers/obj_setup_info/Makefile	2011-12-14 16:50:08 +0000
+++ common/comm_handlers/obj_setup_info/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 obj_setup_info_test:	obj_setup_info.o obj_setup_info_test.cpp
 	@rm -f obj_setup_info_test
-	g++ -c obj_setup_info_test.cpp -I ../../include -I ../include
-	g++ -o obj_setup_info_test obj_setup_info_test.o obj_setup_info.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c obj_setup_info_test.cpp -I ../../include -I ../include -std=gnu++0x 
+	g++ -o obj_setup_info_test obj_setup_info_test.o obj_setup_info.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x 
 
 obj_setup_info.o:	obj_setup_info.cpp obj_setup_info.h Makefile
 	@rm -f obj_setup_info.o
-	g++ -c -O3 obj_setup_info.cpp -I ../include -I../..//include
+	g++ -c -O3 obj_setup_info.cpp -I ../include -I../..//include -std=gnu++0x  
 
 clean:
 	@rm -vf *.o ../include/obj_setup_info.h ../obj/obj_setup_info.o obj_setup_info_test

=== modified file 'common/comm_handlers/sim_db_wrapper/Makefile'
--- common/comm_handlers/sim_db_wrapper/Makefile	2011-12-29 10:52:50 +0000
+++ common/comm_handlers/sim_db_wrapper/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 sim_db_wrapper_test:	sim_db_wrapper.o sim_db_wrapper_test.cpp
 	@rm -f sim_db_wrapper_test
-	g++ -c sim_db_wrapper_test.cpp -I ../../include -I ../include
-	g++ -o sim_db_wrapper_test sim_db_wrapper_test.o sim_db_wrapper.o ../obj/ack_nak.o ../obj/obj_setup_info.o ../obj/sim_stop.o  ../obj/tq_obj.o ../obj/location_data.o ../obj/sim_setup_info.o  ../obj/sim_termination.o ../obj/tq_update.o ../obj/velocity_data.o   ../obj/triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c sim_db_wrapper_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o sim_db_wrapper_test sim_db_wrapper_test.o sim_db_wrapper.o ../obj/ack_nak.o ../obj/obj_setup_info.o ../obj/sim_stop.o  ../obj/tq_obj.o ../obj/location_data.o ../obj/sim_setup_info.o  ../obj/sim_termination.o ../obj/tq_update.o ../obj/velocity_data.o   ../obj/triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 sim_db_wrapper.o:	sim_db_wrapper.cpp sim_db_wrapper.h Makefile
 	@rm -f sim_db_wrapper.o
-	g++ -c -O3 sim_db_wrapper.cpp -I ../include -I ../../include
+	g++ -c -O3 sim_db_wrapper.cpp -I ../include -I ../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/sim_db_wrapper.h ../obj/sim_db_wrapper.o sim_db_wrapper_test

=== modified file 'common/comm_handlers/sim_db_wrapper/sim_db_wrapper.h'
--- common/comm_handlers/sim_db_wrapper/sim_db_wrapper.h	2011-12-29 10:52:50 +0000
+++ common/comm_handlers/sim_db_wrapper/sim_db_wrapper.h	2012-04-07 14:48:19 +0000
@@ -25,17 +25,17 @@
 #include <sim_stop.h>
 #include <sim_termination.h>
 #include <sim_to_db_wrapper.pb.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
 #include <stdint.h>
 
 namespace nrtb_com {
 
-typedef boost::shared_ptr<com_ack> ack_p;
-typedef boost::shared_ptr<com_nak> nak_p;
-typedef boost::shared_ptr<com_tq_update> tq_update_p;
-typedef boost::shared_ptr<com_sim_setup> sim_setup_p;
-typedef boost::shared_ptr<com_sim_termination> sim_end_p;
-typedef boost::shared_ptr<com_request_sim_stop> request_stop_p;
+typedef std::unique_ptr<com_ack> ack_p;
+typedef std::unique_ptr<com_nak> nak_p;
+typedef std::unique_ptr<com_tq_update> tq_update_p;
+typedef std::unique_ptr<com_sim_setup> sim_setup_p;
+typedef std::unique_ptr<com_sim_termination> sim_end_p;
+typedef std::unique_ptr<com_request_sim_stop> request_stop_p;
     
 class com_sim_to_db
 {

=== modified file 'common/comm_handlers/sim_info/Makefile'
--- common/comm_handlers/sim_info/Makefile	2011-12-14 18:18:58 +0000
+++ common/comm_handlers/sim_info/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 sim_setup_info_test:	sim_setup_info.o sim_setup_info_test.cpp
 	@rm -f sim_setup_info_test
-	g++ -c sim_setup_info_test.cpp -I ../../include -I ../include
-	g++ -o sim_setup_info_test sim_setup_info_test.o sim_setup_info.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../obj/obj_setup_info.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c sim_setup_info_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o sim_setup_info_test sim_setup_info_test.o sim_setup_info.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../obj/obj_setup_info.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 sim_setup_info.o:	sim_setup_info.cpp sim_setup_info.h Makefile
 	@rm -f sim_setup_info.o
-	g++ -c -O3 sim_setup_info.cpp -I ../include -I../../include
+	g++ -c -O3 sim_setup_info.cpp -I ../include -I../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/sim_setup_info.h ../obj/sim_setup_info.o sim_setup_info_test

=== modified file 'common/comm_handlers/sim_info/sim_setup_info.cpp'
--- common/comm_handlers/sim_info/sim_setup_info.cpp	2011-11-29 01:02:12 +0000
+++ common/comm_handlers/sim_info/sim_setup_info.cpp	2012-04-07 14:48:19 +0000
@@ -50,8 +50,8 @@
   int count = ext->item_size();
   for (int i=0; i<count; i++)
   {
-	obj_p t(new com_obj_setup(ext->mutable_item(i)));
-	items.push_back(t);
+    obj_p t(std::move(new com_obj_setup(ext->mutable_item(i))));
+    items.push_back(std::move(t));
   };
 };
 

=== modified file 'common/comm_handlers/sim_info/sim_setup_info.h'
--- common/comm_handlers/sim_info/sim_setup_info.h	2011-11-29 01:02:12 +0000
+++ common/comm_handlers/sim_info/sim_setup_info.h	2012-04-07 14:48:19 +0000
@@ -22,7 +22,7 @@
 #include <obj_setup_info.h>
 #include <sim_management.pb.h>
 #include <vector>
-#include <boost/shared_ptr.hpp>
+#include <memory>
 
 namespace nrtb_com {
 
@@ -34,7 +34,7 @@
   uint32_t quanta_ms;
   uint32_t max_quantas;
   std::string started_by;
-  typedef boost::shared_ptr<com_obj_setup> obj_p;
+  typedef std::unique_ptr<com_obj_setup> obj_p;
   typedef std::vector<obj_p> obj_list;
   obj_list items;
   

=== modified file 'common/comm_handlers/sim_info/sim_setup_info_test.cpp'
--- common/comm_handlers/sim_info/sim_setup_info_test.cpp	2011-11-29 01:02:12 +0000
+++ common/comm_handlers/sim_info/sim_setup_info_test.cpp	2012-04-07 14:48:19 +0000
@@ -37,7 +37,7 @@
   {
 	nrtb_com::com_sim_setup::obj_p o(new nrtb_com::com_obj_setup());
 	o->uid = i;
-	t.items.push_back(o);
+	t.items.push_back(std::move(o));
   };
   // run the test.
   nrtb_msg::sim_setup_data gpb;

=== modified file 'common/comm_handlers/sim_stop/Makefile'
--- common/comm_handlers/sim_stop/Makefile	2011-12-14 18:52:24 +0000
+++ common/comm_handlers/sim_stop/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 sim_stop_test:	sim_stop.o sim_stop_test.cpp
 	@rm -f sim_stop_test
-	g++ -c sim_stop_test.cpp -I ../../include -I ../include
-	g++ -o sim_stop_test sim_stop_test.o sim_stop.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c sim_stop_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o sim_stop_test sim_stop_test.o sim_stop.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 sim_stop.o:	sim_stop.cpp sim_stop.h Makefile
 	@rm -f sim_stop.o
-	g++ -c -O3 sim_stop.cpp -I ../include -I ../../include
+	g++ -c -O3 sim_stop.cpp -I ../include -I ../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/sim_stop.h ../obj/sim_stop.o sim_stop_test

=== modified file 'common/comm_handlers/sim_stop/sim_stop.h'
--- common/comm_handlers/sim_stop/sim_stop.h	2011-12-06 10:43:16 +0000
+++ common/comm_handlers/sim_stop/sim_stop.h	2012-04-07 14:48:19 +0000
@@ -20,7 +20,6 @@
 #define sim_stop_header
 
 #include <sim_management.pb.h>
-#include <boost/shared_ptr.hpp>
 
 namespace nrtb_com {
 

=== modified file 'common/comm_handlers/sim_termination/Makefile'
--- common/comm_handlers/sim_termination/Makefile	2011-12-14 18:23:49 +0000
+++ common/comm_handlers/sim_termination/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 sim_termination_test:	sim_termination.o sim_termination_test.cpp
 	@rm -f sim_termination_test
-	g++ -c sim_termination_test.cpp -I ../../include -I ../include
-	g++ -o sim_termination_test sim_termination_test.o sim_termination.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c sim_termination_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o sim_termination_test sim_termination_test.o sim_termination.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 sim_termination.o:	sim_termination.cpp sim_termination.h Makefile
 	@rm -f sim_termination.o
-	g++ -c -O3 sim_termination.cpp -I ../include -I../../include
+	g++ -c -O3 sim_termination.cpp -I ../include -I../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/sim_termination.h ../obj/sim_termination.o sim_termination_test

=== modified file 'common/comm_handlers/sim_termination/sim_termination.h'
--- common/comm_handlers/sim_termination/sim_termination.h	2011-12-06 10:07:51 +0000
+++ common/comm_handlers/sim_termination/sim_termination.h	2012-04-07 14:48:19 +0000
@@ -20,7 +20,6 @@
 #define sim_termination_header
 
 #include <sim_management.pb.h>
-#include <boost/shared_ptr.hpp>
 
 namespace nrtb_com {
 

=== modified file 'common/comm_handlers/tq_obj_data/Makefile'
--- common/comm_handlers/tq_obj_data/Makefile	2011-12-14 18:56:08 +0000
+++ common/comm_handlers/tq_obj_data/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 tq_obj_test:	tq_obj.o tq_obj_test.cpp
 	@rm -f tq_obj_test
-	g++ -c tq_obj_test.cpp -I ../../include -I ../include
-	g++ -o tq_obj_test tq_obj_test.o tq_obj.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c tq_obj_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o tq_obj_test tq_obj_test.o tq_obj.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 tq_obj.o:	tq_obj.cpp tq_obj.h Makefile
 	@rm -f tq_obj.o
-	g++ -c -O3 tq_obj.cpp -I ../include -I../../include
+	g++ -c -O3 tq_obj.cpp -I ../include -I../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/tq_obj.h ../obj/tq_obj.o tq_obj_test

=== modified file 'common/comm_handlers/tq_update/Makefile'
--- common/comm_handlers/tq_update/Makefile	2011-12-14 19:02:20 +0000
+++ common/comm_handlers/tq_update/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 tq_update_test:	tq_update.o tq_update_test.cpp
 	@rm -f tq_update_test
-	g++ -c tq_update_test.cpp -I ../../include -I ../include
-	g++ -o tq_update_test tq_update_test.o tq_update.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../obj/tq_obj.o ../obj/obj_setup_info.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c tq_update_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o tq_update_test tq_update_test.o tq_update.o ../obj/triplet.o ../obj/location_data.o ../obj/velocity_data.o ../obj/tq_obj.o ../obj/obj_setup_info.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 tq_update.o:	tq_update.cpp tq_update.h Makefile
 	@rm -f tq_update.o
-	g++ -c -O3 tq_update.cpp -I ../include -I../../include
+	g++ -c -O3 tq_update.cpp -I ../include -I../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/tq_update.h ../obj/tq_update.o tq_update_test

=== modified file 'common/comm_handlers/tq_update/tq_update.cpp'
--- common/comm_handlers/tq_update/tq_update.cpp	2011-12-13 01:21:16 +0000
+++ common/comm_handlers/tq_update/tq_update.cpp	2012-04-07 14:48:19 +0000
@@ -17,7 +17,6 @@
  **********************************************/
 
 #include "tq_update.h"
-#include <boost/shared_ptr.hpp>
 
 
 namespace nrtb_com

=== modified file 'common/comm_handlers/tq_update/tq_update.h'
--- common/comm_handlers/tq_update/tq_update.h	2011-12-13 01:21:16 +0000
+++ common/comm_handlers/tq_update/tq_update.h	2012-04-07 14:48:19 +0000
@@ -20,7 +20,7 @@
 #define tq_update_header
 
 #include <vector>
-#include <boost/shared_ptr.hpp>
+#include <memory>
 #include <location_data.h>
 #include <velocity_data.h>
 #include <tq_obj.h>
@@ -32,8 +32,8 @@
 class com_tq_update
 {
 public:
-  typedef boost::shared_ptr<nrtb_com::com_tq_obj_update> up_p;
-  typedef boost::shared_ptr<nrtb_com::com_obj_setup> obj_p;
+  typedef std::unique_ptr<nrtb_com::com_tq_obj_update> up_p;
+  typedef std::unique_ptr<nrtb_com::com_obj_setup> obj_p;
   typedef std::vector<nrtb_com::com_tq_obj_update> up_list;
   typedef std::vector<nrtb_com::com_obj_setup> ob_list;
   uint32_t quanta_id;

=== modified file 'common/comm_handlers/triplet/Makefile'
--- common/comm_handlers/triplet/Makefile	2011-12-14 16:30:12 +0000
+++ common/comm_handlers/triplet/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 triplet_test:	triplet.o triplet_test.cpp
 	@rm -f triplet_test
-	g++ -c triplet_test.cpp -I ../../include
-	g++ -o triplet_test triplet_test.o triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c triplet_test.cpp -I ../../include -std=gnu++0x
+	g++ -o triplet_test triplet_test.o triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 triplet.o:	triplet.cpp triplet.h Makefile
 	@rm -f triplet.o
-	g++ -c -O3 triplet.cpp -I../../include
+	g++ -c -O3 triplet.cpp -I../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/triplet.h ../obj/triplet.o triplet_test

=== modified file 'common/comm_handlers/velocity_data/Makefile'
--- common/comm_handlers/velocity_data/Makefile	2011-12-14 16:43:23 +0000
+++ common/comm_handlers/velocity_data/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 velocity_data_test:	velocity_data.o velocity_data_test.cpp
 	@rm -f velocity_data_test
-	g++ -c velocity_data_test.cpp -I ../../include -I ../include
-	g++ -o velocity_data_test velocity_data_test.o velocity_data.o ../obj/triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread
+	g++ -c velocity_data_test.cpp -I ../../include -I ../include -std=gnu++0x
+	g++ -o velocity_data_test velocity_data_test.o velocity_data.o ../obj/triplet.o ../../lib/nrtb_common.a ../../lib/nrtb_gpb.a -lprotobuf -lpthread -std=gnu++0x
 
 velocity_data.o:	velocity_data.cpp velocity_data.h Makefile
 	@rm -f velocity_data.o
-	g++ -c -O3 velocity_data.cpp -I ../include -I../../include
+	g++ -c -O3 velocity_data.cpp -I ../include -I../../include -std=gnu++0x
 
 clean:
 	@rm -vf *.o ../include/velocity_data.h ../obj/velocity_data.o velocity_data_test

=== modified file 'common/common_rl/Makefile'
--- common/common_rl/Makefile	2011-07-21 02:16:12 +0000
+++ common/common_rl/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 common.o:	common.h common.cpp Makefile
 	@rm -f common.o
-	g++ -c -O3 common.cpp
+	g++ -c -O3 common.cpp  -std=gnu++0x
 	
 common_rl_test:	common.o common_rl_test.cpp
 	@rm -f common_rl_test
-	g++ -c common_rl_test.cpp
-	g++ -o common_rl_test common_rl_test.o common.o
+	g++ -c common_rl_test.cpp -std=gnu++0x
+	g++ -o common_rl_test common_rl_test.o common.o -std=gnu++0x
 
 clean:
 	@rm -rvf *.o  ../include/common.h ../obj/common.o common_rl_test

=== modified file 'common/confreader/Makefile'
--- common/confreader/Makefile	2011-08-13 15:06:08 +0000
+++ common/confreader/Makefile	2012-04-07 14:48:19 +0000
@@ -26,12 +26,12 @@
 
 confreader.o:	confreader.h confreader.cpp Makefile 
 	@rm -f confreader.o
-	g++ -c confreader.cpp -I../include
+	g++ -c confreader.cpp -I../include -std=gnu++0x
 
 conftest:	confreader.o conftest.cpp
 	@rm -f conftest
-	g++ -c conftest.cpp -I../include
-	g++ -o conftest conftest.o confreader.o ../obj/common.o ../obj/log_setup.o ../obj/base_thread.o -lpthread -lPocoFoundation -lPocoUtil
+	g++ -c conftest.cpp -I../include -std=gnu++0x
+	g++ -o conftest conftest.o confreader.o ../obj/common.o ../obj/log_setup.o ../obj/base_thread.o -lpthread -lPocoFoundation -lPocoUtil -std=gnu++0x
 
 clean:
 	@rm -rvf *.o conftest ../include/confreader.h ../obj/confreader.o conf_test.log

=== modified file 'common/linear_queue/Makefile'
--- common/linear_queue/Makefile	2011-10-07 00:01:15 +0000
+++ common/linear_queue/Makefile	2012-04-07 14:48:19 +0000
@@ -23,8 +23,8 @@
 
 linear_queue_test:	linear_queue.h linear_queue_test.cpp
 	@rm -f linear_queue_test
-	g++ -c linear_queue_test.cpp -I../include
-	g++ -o linear_queue_test linear_queue_test.o ../obj/common.o ../obj/base_thread.o -lpthread 
+	g++ -c linear_queue_test.cpp -I../include -std=gnu++0x
+	g++ -o linear_queue_test linear_queue_test.o ../obj/common.o ../obj/base_thread.o -lpthread -std=gnu++0x
 
 clean:
 	@rm -rvf *.o linear_queue_test ../include/linear_queue.h *.log ../obj/linear_queue.o

=== modified file 'common/logger/Makefile'
--- common/logger/Makefile	2010-12-31 14:48:07 +0000
+++ common/logger/Makefile	2012-04-07 14:48:19 +0000
@@ -27,12 +27,12 @@
 
 log_setup.o:	log_setup.h log_setup.cpp Makefile
 	@rm -f log_setup.o
-	g++ -c log_setup.cpp -I ../include
+	g++ -c log_setup.cpp -I ../include -std=gnu++0x
 
 log_test:	log_setup.o log_test.cpp Makefile
 	@rm -vf log_test
-	g++ -c log_test.cpp -I../include 
-	g++ -o log_test log_setup.o log_test.o -lPocoFoundation
+	g++ -c log_test.cpp -I../include  -std=gnu++0x
+	g++ -o log_test log_setup.o log_test.o -lPocoFoundation -std=gnu++0x
 #	g++ -g common_test.cpp  -idirafter . -o common_test
 
 clean:

=== modified file 'common/point/Makefile'
--- common/point/Makefile	2011-07-20 02:12:28 +0000
+++ common/point/Makefile	2012-04-07 14:48:19 +0000
@@ -26,7 +26,7 @@
 
 common_test:	common_test.cpp triad.h Makefile ../include/common.h
 	@rm -vf common_test
-	g++ -O3 common_test.cpp -I ../include ../obj/common.o -o common_test
+	g++ -O3 common_test.cpp -I ../include ../obj/common.o -o common_test -std=gnu++0x
 
 clean:
 	@rm -vf *.o common_test ../include/triad.h

=== modified file 'common/serializer/Makefile'
--- common/serializer/Makefile	2011-07-30 15:32:43 +0000
+++ common/serializer/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 serializer.o:	serializer.h serializer.cpp Makefile
 	@rm -f serializer.o
-	g++ -c serializer.cpp -I ../include
+	g++ -c serializer.cpp -I ../include -std=gnu++0x
 
 serializer_test:	serializer.o serializer_test.cpp
 	@rm -f serializer_test
-	g++ -c serializer_test.cpp -I../include
-	g++ -o serializer_test serializer_test.o serializer.o ../obj/base_thread.o -lpthread ../obj/common.o
+	g++ -c serializer_test.cpp -I../include -std=gnu++0x
+	g++ -o serializer_test serializer_test.o serializer.o ../obj/base_thread.o -lpthread ../obj/common.o -std=gnu++0x
 
 clean:
 	@rm -rvf *.o serializer_test ../include/serializer.h ../obj/serializer.o

=== modified file 'common/singleton/Makefile'
--- common/singleton/Makefile	2011-08-13 14:19:56 +0000
+++ common/singleton/Makefile	2012-04-07 14:48:19 +0000
@@ -24,8 +24,8 @@
 
 singleton_test:	singleton_test.cpp Makefile
 	@rm -f singleton_test
-	g++ -c singleton_test.cpp -I ../include 
-	g++ -o singleton_test singleton_test.o ../obj/base_thread.o ../obj/common.o ../obj/serializer.o -lpthread
+	g++ -c singleton_test.cpp -I ../include -std=gnu++0x
+	g++ -o singleton_test singleton_test.o ../obj/base_thread.o ../obj/common.o ../obj/serializer.o -lpthread -std=gnu++0x
 
 clean:
 	@rm -rvf *.o singleton_test ../include/singleton.h

=== modified file 'common/sockets/base_socket.cpp'
--- common/sockets/base_socket.cpp	2012-04-01 14:36:19 +0000
+++ common/sockets/base_socket.cpp	2012-04-07 14:48:19 +0000
@@ -588,16 +588,28 @@
 
 void tcp_server_socket_factory::start_listen()
 {
-	// take no action if the listen thread is already running.
-	if (!is_running())
-	{
-		// start it up!
-		start();
-	}
-	else
-	{
-	  throw already_running_exception();
-	};
+  // take no action if the listen thread is already running.
+  if (!is_running())
+  {
+    // start it up!
+    start();
+    int countdown = 99;
+    while (!listening() and countdown)
+    {
+      countdown--;
+      usleep(1e3);
+    }
+    if (!countdown)
+    {
+      bind_failure_exception e;
+      e.store(_address);
+      throw e;
+    };
+  }
+  else
+  {
+    throw already_running_exception();
+  };
 };
 
 void tcp_server_socket_factory::stop_listen()
@@ -608,12 +620,22 @@
     // stop the listener thread
     stop();
     join();
+    listen_sock.reset();
   };
 };
 
 bool tcp_server_socket_factory::listening()
 {
   bool running = is_running();
+  if (listen_sock)
+  {
+    running = running
+      and listen_sock->status() == tcp_socket::sock_connect;
+  }
+  else
+  {
+    running = false;
+  };
   return running;
 };
 
@@ -627,35 +649,29 @@
 	return _backlog;
 };
 
-//socket closer to use with exit trap.
-void closeme(void * sock)
-{
-  std::cerr << "in thread cleanup sock closer" << std::endl;
-  int & socket = *(static_cast<int*>(sock));
-  try { ::close(socket); } catch  (...) {};
-  std::cerr << "socker closer done." << std::endl;
-};
-
 void tcp_server_socket_factory::run()
 {
   // set up the listening socket.
-  int listen_sock;
+  int sock;
   _last_thread_fault = 0;
   bool go = false;
   try
   {
-    listen_sock = socket(AF_INET,SOCK_STREAM,0);
+    sock = socket(AF_INET,SOCK_STREAM,0);
     sockaddr_in myaddr;
     myaddr = tcp_socket::str_to_sockaddr(_address);
-    int a = bind(listen_sock,(sockaddr *) &myaddr,sizeof(myaddr));
-    int b = listen(listen_sock,_backlog);
+    int a = bind(sock,(sockaddr *) &myaddr,sizeof(myaddr));
+    int b = listen(sock,_backlog);
     if (a || b)
     {
       go = false;
       if (a) _last_thread_fault += 1;
       if (b) _last_thread_fault += 2;
     }
-    else go = true;
+    else
+    {
+      go = true;
+    };
   }
   catch (...)
   {
@@ -668,13 +684,31 @@
     exit(0);
   };
   // make sure the listener is closed when we exit.
-  pthread_cleanup_push(closeme, (void*) &listen_sock);
+  // also prevides an external hook to socket.
+  listen_sock.reset(new tcp_socket(sock));
   // processing loop
-  while (go)
+  while
+  (
+    go
+    and listen_sock
+    and (listen_sock->status() == tcp_socket::sock_connect)
+  )
   {
     // accept a new connection
     bool good_connect = true;
-    int new_conn = accept(listen_sock,NULL,NULL);
+    int new_conn = accept(sock,NULL,NULL);
+    // is the listener still open?
+    if
+    (
+      (!listen_sock)
+      and (listen_sock->status() != tcp_socket::sock_connect)
+    )
+    {
+      // the listner socket is not available.. get out of here.
+      listen_sock.reset();
+      _last_thread_fault = 300;
+      exit(0);
+    };
     // validate the accept return value.
     if (new_conn == -1)
     {
@@ -730,35 +764,7 @@
       };
     };
   }; // while go;
-  pthread_cleanup_pop(0);
 };
 
 } // namespace nrtb
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

=== modified file 'common/sockets/base_socket.h'
--- common/sockets/base_socket.h	2012-03-15 00:10:06 +0000
+++ common/sockets/base_socket.h	2012-04-07 14:48:19 +0000
@@ -421,6 +421,9 @@
 		int _last_thread_fault;
 		// Provides the listener thread.
 		void run();
+    // pointer to the listener socket
+    typedef std::shared_ptr<tcp_socket> lsock_p;
+    lsock_p listen_sock;
 		
 	protected:
 

=== modified file 'common/sockets/socket_test.cpp'
--- common/sockets/socket_test.cpp	2012-04-01 14:53:47 +0000
+++ common/sockets/socket_test.cpp	2012-04-07 14:48:19 +0000
@@ -104,17 +104,6 @@
   {
     // start the receiver/server
     test_server.start_listen();
-    int countdown = 99;
-    while ((!test_server.listening()) and countdown)
-    {
-      usleep(1e3);
-      countdown++;
-    };
-    if (!countdown)
-    {
-      cerr << "Could not start listener." << endl;
-      exit(1);
-    }
     cout << "test_server ready." << endl;
 
     // Send test messages

=== modified file 'common/threads/Makefile'
--- common/threads/Makefile	2011-09-17 01:21:36 +0000
+++ common/threads/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 base_thread.o:	base_thread.cpp base_thread.h Makefile
 	@rm -f base_thread.o
-	g++ -c -O3 base_thread.cpp -I ../include
+	g++ -c -O3 base_thread.cpp -I ../include -std=gnu++0x
 
 thread_test:	base_thread.o thread_test.cpp
 	@rm -f thread_test
-	g++ -c thread_test.cpp -I../include
-	g++ -o thread_test thread_test.o base_thread.o ../obj/hires_timer.o ../obj/common.o -lpthread
+	g++ -c thread_test.cpp -I../include -std=gnu++0x
+	g++ -o thread_test thread_test.o base_thread.o ../obj/hires_timer.o ../obj/common.o -lpthread -std=gnu++0x
 
 clean:
 	@rm -rvf *.o thread_test ../include/base_thread.h ../obj/base_thread.o

=== modified file 'common/timer/Makefile'
--- common/timer/Makefile	2011-07-21 22:30:26 +0000
+++ common/timer/Makefile	2012-04-07 14:48:19 +0000
@@ -24,12 +24,12 @@
 
 hires_timer.o:	hires_timer.h hires_timer.cpp Makefile
 	@rm -f hires_timer.o
-	g++ -c -O3 hires_timer.cpp
+	g++ -c -O3 hires_timer.cpp -std=gnu++0x
 
 timer_test:	hires_timer.o timer_test.cpp
 	@rm -f timer_test
-	g++ -c timer_test.cpp
-	g++ -o timer_test timer_test.o hires_timer.o
+	g++ -c timer_test.cpp -std=gnu++0x
+	g++ -o timer_test timer_test.o hires_timer.o -std=gnu++0x
 
 clean:
 	@rm -rvf *.o timer_test ../include/hires_timer.h ../obj/hires_timer.o

=== modified file 'common/transceiver/transceiver_test.cpp'
--- common/transceiver/transceiver_test.cpp	2012-04-01 04:32:10 +0000
+++ common/transceiver/transceiver_test.cpp	2012-04-07 14:48:19 +0000
@@ -201,10 +201,6 @@
     // kick off the listener thread.
     listener server(address,5);
     server.start_listen();
-    while (!server.listening())
-    {
-      usleep(1e3);
-    };
     cout << "Listener thread is ready." << endl;
 
     // set up our sender
@@ -243,6 +239,11 @@
     };
     usleep(1e4);
   }
+  catch (tcp_server_socket_factory::bind_failure_exception & e)
+  {
+    cout << "Listener could not bind " << e.comment() << endl;
+    er_count.inc();
+  }
   catch (...)
   {
 	  cout << "exception caught during test." << endl;


Follow ups