aboutsummaryrefslogtreecommitdiff
path: root/flow-native
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2013-07-08 14:29:16 +0200
committerJakob Odersky <jodersky@gmail.com>2013-07-08 14:29:30 +0200
commitbf516e5e971f76df4f3ba455decc628eaa7fd7b4 (patch)
treeab1d532a346772fb4fecd526e11cfe107c07db4f /flow-native
parenta0ce1409a3c893edcce48a3bbf5659d57b5ef6a9 (diff)
downloadakka-serial-bf516e5e971f76df4f3ba455decc628eaa7fd7b4.tar.gz
akka-serial-bf516e5e971f76df4f3ba455decc628eaa7fd7b4.tar.bz2
akka-serial-bf516e5e971f76df4f3ba455decc628eaa7fd7b4.zip
make pipe non-blocking in posix compliant source code
Diffstat (limited to 'flow-native')
-rw-r--r--flow-native/unix/src/flow.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/flow-native/unix/src/flow.c b/flow-native/unix/src/flow.c
index aa1b213..8a47945 100644
--- a/flow-native/unix/src/flow.c
+++ b/flow-native/unix/src/flow.c
@@ -134,13 +134,18 @@ int serial_open(const char* port_name, int baud, struct serial_config** serial)
}
int pipe_fd[2];
-//TODO make pipe non-blocking
if (pipe(pipe_fd) < 0) {
DEBUG(perror("open pipe"););
close(fd);
return E_IO;
}
+ if (fcntl(pipe_fd[0], F_SETFL, O_NONBLOCK) < 0 || fcntl(pipe_fd[1], F_SETFL, O_NONBLOCK) < 0) {
+ DEBUG(perror("make pipe non-blocking"););
+ close(fd);
+ return E_IO;
+ }
+
struct serial_config* s = malloc(sizeof(s));
if (s == NULL) {
DEBUG(perror("allocate memory for serial configuration"););