This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Threading bug in sunrpc/auth_none.c


On Fri, Apr 12, 2002 at 11:52:49AM -0700, Zack Weinberg wrote:
> On Thu, Apr 11, 2002 at 03:36:47PM -0700, Ulrich Drepper wrote:
> > I'm not going to change anything until I see some code (means a test
> > program).
> 
> main(void)
> {
>     pthread_t tid;
>     pid_t pid;
>     int err;
>     SVCXPRT *svx;
>     CLIENT *clnt;
>     struct sockaddr_in sin;
>     struct timeval wait = { 5, 0 };
>     int sock = RPC_ANYSOCK;
> 
>     svx = svcudp_create(RPC_ANYSOCK);
>     svc_register(svx, PROGNUM, VERSNUM, dispatch, 0);
> 
>     pid = fork();
>     if(pid == -1)
>     {
> 	perror("fork");
> 	return 1;
>     }
>     if (pid == 0)
>       svc_run();
> 
>     inet_aton("127.0.0.1", &sin.sin_addr);
>     sin.sin_port = htons(svx->xp_port);
>     sin.sin_family = AF_INET;
> 
>     clnt = clntudp_create(&sin, PROGNUM, VERSNUM, wait, &sock);
>     
>     /* Test in this thread */
>     test_one_call(clnt);
> 
>     /* Test in a child thread */
>     err = pthread_create(&tid, 0, thread_wrapper, (void *)clnt);
>     if(err)
> 	fprintf(stderr, "pthread_create: %s\n", strerror(err));
>     err = pthread_join(tid, 0);
>     if(err)
> 	fprintf(stderr, "pthread_join: %s\n", strerror(err));
> 

I don't think calling clntudp_create in one thread and using it in a
different thread is supported. You may run into more problems. I posted
a patch to support it. But very few people are interested in it.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]