Date: Mon, 8 Mar 2010 19:00:17 GMT From: Sam Robb <samrobb@averesystems.com> To: freebsd-threads@FreeBSD.org Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots Message-ID: <201003081900.o28J0H6n081057@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR threads/144558; it has been noted by GNATS. From: Sam Robb <samrobb@averesystems.com> To: bug-followup@FreeBSD.org, Sam Robb <samrobb@averesystems.com> Cc: Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots Date: Mon, 8 Mar 2010 13:36:16 -0500 Example program that shows repeated allocation of thread-specific data = slots caused by calling clnt_pcreateerror() from a thread. #include <netinet/in.h> #include <rpc/rpc.h> #include <rpc/clnt.h> #include <rpcsvc/rex.h> #include <stdio.h> #include <assert.h> #include <stdlib.h> void * rce_test(void * arg) { struct sockaddr_in addr; int i =3D 0; pthread_key_t thr_key_start =3D -1; pthread_key_t thr_key_end =3D -1; int * pdata =3D malloc(sizeof(int)); pthread_key_create(&thr_key_start, pdata); printf("thr_key_start =3D %d\n", thr_key_start); for (i =3D 0; i <=3D 25 ; i++) { CLIENT * client =3D NULL; char buf[256]; pthread_key_t thr_key_intermediate =3D -1; sprintf(buf, "Call #%d", i); client =3D clnt_create("127.0.0.2", REXPROG, REXVERS, = "udp"); clnt_pcreateerror(buf); pthread_key_create(&thr_key_intermediate, pdata); printf("thr_key_intermediate =3D %d\n", = thr_key_intermediate); if (client) { clnt_destroy(client); } } pthread_key_create(&thr_key_end, pdata); printf("thr_key_end =3D %d\n", thr_key_end); return pdata; } int main(int argc, char** argv) { pthread_t thread; void *result; pthread_attr_t attr =3D 0; int res =3D 0; res =3D pthread_create(&thread, &attr, rce_test, NULL); assert(res =3D=3D 0); res =3D pthread_join(thread, &result); assert(res =3D=3D 0); return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003081900.o28J0H6n081057>