Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@hunch.net>2009-09-29 01:38:09 +0400
committerJohn Langford <jl@hunch.net>2009-09-29 01:38:09 +0400
commit84d09d675d929d3938a106d33f448dd5b74e14ee (patch)
tree868a1307d7e21d5a113630fa579493aae3431a40 /multisource.cc
parent287eaed15af80a0fd954ea5a54b34cf7b365c0c6 (diff)
Half of cluster parallel once again working.
Diffstat (limited to 'multisource.cc')
-rw-r--r--multisource.cc13
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);
}