Page MenuHomeFreeBSD

D54939.id170676.diff
No OneTemporary

D54939.id170676.diff

diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c
--- a/lib/libc/rpc/rpc_soc.c
+++ b/lib/libc/rpc/rpc_soc.c
@@ -307,19 +307,10 @@
}
/*
- * All the following clnt_broadcast stuff is convulated; it supports
- * the earlier calling style of the callback function
+ * Support the earlier calling style of the callback function with a
+ * per-thread temporary copy of the real callback.
*/
-static thread_key_t clnt_broadcast_key;
-static resultproc_t clnt_broadcast_result_main;
-static once_t clnt_broadcast_once = ONCE_INITIALIZER;
-
-static void
-clnt_broadcast_key_init(void)
-{
-
- thr_keycreate(&clnt_broadcast_key, free);
-}
+static _Thread_local resultproc_t clnt_broadcast_result;
/*
* Need to translate the netbuf address into sockaddr_in address.
@@ -334,14 +325,8 @@
* struct netconfig *nconf; // Netconf of the transport
*/
{
- resultproc_t clnt_broadcast_result;
-
if (strcmp(nconf->nc_netid, "udp"))
return (FALSE);
- if (thr_main())
- clnt_broadcast_result = clnt_broadcast_result_main;
- else
- clnt_broadcast_result = (resultproc_t)thr_getspecific(clnt_broadcast_key);
return (*clnt_broadcast_result)(resultp,
(struct sockaddr_in *)addr->buf);
}
@@ -363,16 +348,16 @@
* resultproc_t eachresult; // call with each result obtained
*/
{
+ enum clnt_stat ret;
- if (thr_main())
- clnt_broadcast_result_main = eachresult;
- else {
- thr_once(&clnt_broadcast_once, clnt_broadcast_key_init);
- thr_setspecific(clnt_broadcast_key, (void *) eachresult);
- }
- return rpc_broadcast((rpcprog_t)prog, (rpcvers_t)vers,
+ clnt_broadcast_result = eachresult;
+
+ ret = rpc_broadcast((rpcprog_t)prog, (rpcvers_t)vers,
(rpcproc_t)proc, xargs, argsp, xresults, resultsp,
(resultproc_t) rpc_wrap_bcast, "udp");
+
+ clnt_broadcast_result = NULL;
+ return (ret);
}
/*

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 1:21 PM (18 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28100673
Default Alt Text
D54939.id170676.diff (1 KB)

Event Timeline