diff options
author | John Langford <jl@hunch.net> | 2009-09-29 01:38:09 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2009-09-29 01:38:09 +0400 |
commit | 84d09d675d929d3938a106d33f448dd5b74e14ee (patch) | |
tree | 868a1307d7e21d5a113630fa579493aae3431a40 /multisource.cc | |
parent | 287eaed15af80a0fd954ea5a54b34cf7b365c0c6 (diff) |
Half of cluster parallel once again working.
Diffstat (limited to 'multisource.cc')
-rw-r--r-- | multisource.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/multisource.cc b/multisource.cc index 97ebfd8b..2a7f2bb2 100644 --- a/multisource.cc +++ b/multisource.cc @@ -3,17 +3,26 @@ #include <sys/types.h> #include <sys/socket.h> - +#include <errno.h> bool get_prediction(int sock, prediction &p) { return (recv(sock, &p, sizeof(p), MSG_DONTWAIT) == sizeof(p)); } +bool blocking_get_prediction(int sock, prediction &p) +{ + return (read(sock, &p, sizeof(p)) == sizeof(p)); +} + void send_prediction(int sock, prediction pred) { if (write(sock,&pred,sizeof(prediction)) < (int)sizeof(prediction)) - cerr << "argh! bad write!" << endl; + { + cerr << "argh! bad write! " << endl; + perror(NULL); + exit(0); + } fsync(sock); } |