diff os_support.c @ 2057:857fbfeb2fa0 libavformat

implement ff_socket_nonblock and use it in networking code
author alex
date Fri, 27 Apr 2007 00:41:50 +0000
parents 3d04317ab396
children 8fc44b349f59
line wrap: on
line diff
--- a/os_support.c	Fri Apr 27 00:35:54 2007 +0000
+++ b/os_support.c	Fri Apr 27 00:41:50 2007 +0000
@@ -114,6 +114,14 @@
     }
     return 0;
 }
+
+int ff_socket_nonblock(int socket, int enable)
+{
+   if (enable)
+      return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
+   else
+      return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
+}
 #endif /* CONFIG_NETWORK */
 
 #ifdef CONFIG_FFSERVER