Posted: Thu Apr 24, 2003 9:46 pm Post subject: [Asterisk-Dev] Blocking open(2) does not work with some thre
Some thread implementations have problems when open(2) blocks --
this changes an open on a named pipe to be non-blocking, and resets
the descriptor to be blocking afterwards.
Index: pbx/pbx_wilcalu.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_wilcalu.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 pbx_wilcalu.c
--- pbx/pbx_wilcalu.c 16 Mar 2003 22:37:31 -0000 1.1.1.2
+++ pbx/pbx_wilcalu.c 24 Apr 2003 21:47:15 -0000
@@ -58,7 +58,9 @@
{
pthread_t dialstring_thread;
char * sendbufptr=sendbuf;
- int fd=open(dialfile,O_RDONLY);
+ int fd=open(dialfile,O_RDONLY|O_NONBLOCK);
+ int flags = fcntl(fd, F_GETFL);
+ fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
printf("Entered Wil-Calu fd=%d\n",fd);
if(fd<0) {
printf("Autodial: Unable to open file\n");
--
Thorsten Lockert | tholo@sigmasoft.com | Universe, n.:
2121 N. Lakeshore Dr. | tholo@openbsd.org | The problem.
Chapel Hill, NC 27514 | |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum