sscall

UDP based voice chat
git clone git://git.2f30.org/sscall.git
Log | Files | Refs | README | LICENSE

commit 0123c13c951b727a530648501c7c63aaade15028
parent 583a91b8fcbc659b8d4e7f30e2167616ea04fe00
Author: sin <sin@2f30.org>
Date:   Mon Jun  4 16:49:51 +0100

sscall: Make stdin non-blocking


Diffstat:
sscall.c | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/sscall.c b/sscall.c @@ -175,6 +175,19 @@ sig_handler(int signum) } } +void +set_nonblocking(int fd) +{ + int opts; + + opts = fcntl(fd, F_GETFL); + if (opts < 0) + err(1, "fcntl"); + opts = (opts | O_NONBLOCK); + if (fcntl(fd, F_SETFL, opts) < 0) + err(1, "fcntl"); +} + int main(int argc, char *argv[]) { @@ -326,6 +339,8 @@ main(int argc, char *argv[]) inp_pcm_priv.sockfd = cli_sockfd; inp_pcm_priv.servinfo = p0; + set_nonblocking(inp_pcm_priv.fd); + ret = pthread_create(&input_pcm_thread, NULL, input_pcm, NULL);