Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146665223
D54939.id170676.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54939.id170676.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D54939: clnt_broadcast(3): don't free function pointers
Attached
Detach File
Event Timeline
Log In to Comment