Date: Sat, 06 Jun 1998 00:27:49 +1000 (EST) From: Simon Coggins <chaos@oz.org> To: freebsd-current@FreeBSD.ORG Subject: Problem with libc_r and blocking. Message-ID: <XFMail.980606002749.chaos@oz.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] I've come across a problem trying to use c_r on freebsd-current. In the configure script of Roxen (http://www.roxen.com) web server, if you try and make the package use freebsd's libc_r (it takes alittle hacking in configure) when it find the threads functions correctly. But when it gets to test how to set things non-blocking it freezes and locks up. I've attached the .c file of what configure is doing when this happends if you compile this with gcc -pthread -D_THREAD_SAFE -o tst thread_test.c and run it it will lock up if you leave off -pthread it works correctly. Anyone out there have any idea? (are there plans to improve the threads support in freebsd?) I was looking thru the archives and didn't see much in the way of development info. Regards Simon +---------------------------------------------------------------+ | Email: chaos@ultra.net.au, chaos@oz.org, simon@bofh.com.au | | http://www.ultra.net.au/~chaos Ultranet Technical Admin. | | Chaos on IRC, IRC Operator for the OzORG Network | +---------------------------------------------------------------+ --- "I stopped believing in Santa Claus when I was six. Mother took me to see him in a department store and he asked for my autograph." -- Shirley Temple [-- Attachment #2 --] #include <signal.h> #include <stdio.h> #include <errno.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <fcntl.h> #include <sys/filio.h> #include <sys/sockio.h> int set_nonblocking(int fd,int which) { fprintf(stderr, "set_nonblocking()\n"); return fcntl(fd, F_SETFL, which?FNDELAY:0); } int query_nonblocking(int fd) { fprintf(stderr, "query_nonblocking()\n"); return fcntl(fd, F_GETFL, 0) & FNDELAY; } int set_close_on_exec(int fd, int which) { fprintf(stderr, "set_close_on_exec()\n"); return fcntl(fd, F_SETFD, !!which); } void sigalrm_handler0(int tmp) { exit(0); } void sigalrm_handler1(int tmp) { fprintf(stderr,"Failed in alarm handler 1\n"); exit(1); } int main() { int tmp[2]; char foo[1000]; tmp[0]=0; tmp[1]=0; fprintf(stdout, "Testing!!!\n"); set_nonblocking(tmp[0],1); signal(SIGALRM, sigalrm_handler1); alarm(1); read(tmp[0],foo,999); set_nonblocking(tmp[0],0); signal(SIGALRM, sigalrm_handler0); alarm(1); read(tmp[0],foo,999); fprintf(stderr,"Failed at end of main.\n"); exit(1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980606002749.chaos>
