Commit a1daeea4 authored by Davis King's avatar Davis King

More code cleanup

parent 09fa9b17
...@@ -254,6 +254,7 @@ namespace dlib ...@@ -254,6 +254,7 @@ namespace dlib
read_thread_terminated_improperly(false), read_thread_terminated_improperly(false),
outstanding_messages(0), outstanding_messages(0),
num_waiting_nodes(0), num_waiting_nodes(0),
num_terminated_nodes(0),
buf_not_empty(class_mutex), buf_not_empty(class_mutex),
terminated_signal(class_mutex), terminated_signal(class_mutex),
_cons(cons_), _cons(cons_),
...@@ -526,6 +527,15 @@ namespace dlib ...@@ -526,6 +527,15 @@ namespace dlib
auto_mutex lock(class_mutex); auto_mutex lock(class_mutex);
if (error_message.size() != 0) if (error_message.size() != 0)
throw dlib::socket_error(error_message); throw dlib::socket_error(error_message);
if (outstanding_messages != 0)
{
std::ostringstream sout;
sout << "A BSP job was allowed to terminate before all sent messages have been received.\n";
sout << "There are at least " << outstanding_messages << " messages still in flight. Make sure all sent messages\n";
sout << "have a corresponding call to receive().";
throw dlib::socket_error(sout.str());
}
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -117,8 +117,9 @@ namespace dlib ...@@ -117,8 +117,9 @@ namespace dlib
void receive ( void receive (
) )
{ {
int junk; unsigned long id;
if (receive(junk)) shared_ptr<std::string> temp;
if (receive_data(temp,id))
throw dlib::socket_error("Call to bsp_context::receive() got an unexpected message."); throw dlib::socket_error("Call to bsp_context::receive() got an unexpected message.");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment