diff options
author | Jakob Odersky <jodersky@gmail.com> | 2013-07-08 14:29:16 +0200 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2013-07-08 14:29:30 +0200 |
commit | bf516e5e971f76df4f3ba455decc628eaa7fd7b4 (patch) | |
tree | ab1d532a346772fb4fecd526e11cfe107c07db4f | |
parent | a0ce1409a3c893edcce48a3bbf5659d57b5ef6a9 (diff) | |
download | akka-serial-bf516e5e971f76df4f3ba455decc628eaa7fd7b4.tar.gz akka-serial-bf516e5e971f76df4f3ba455decc628eaa7fd7b4.tar.bz2 akka-serial-bf516e5e971f76df4f3ba455decc628eaa7fd7b4.zip |
make pipe non-blocking in posix compliant source code
-rw-r--r-- | flow-binaries/linux/amd64/libflow.so.1.0 | bin | 13624 -> 13676 bytes | |||
-rw-r--r-- | flow-native/unix/src/flow.c | 7 |
2 files changed, 6 insertions, 1 deletions
diff --git a/flow-binaries/linux/amd64/libflow.so.1.0 b/flow-binaries/linux/amd64/libflow.so.1.0 Binary files differindex 40bb343..9d0c6ed 100644 --- a/flow-binaries/linux/amd64/libflow.so.1.0 +++ b/flow-binaries/linux/amd64/libflow.so.1.0 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");); |