about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--include/rpc/rpc.h54
-rw-r--r--linuxthreads/ChangeLog4
-rw-r--r--linuxthreads/cancel.c5
3 files changed, 63 insertions, 0 deletions
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index f925e2b35e..a922218510 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -4,4 +4,58 @@
 /* Now define the internal interfaces.  */
 extern unsigned long _create_xid (void);
 
+/*
+ * Multi-threaded support
+ * Group all global and static variables into a single spot.
+ * This area is allocated on a per-thread basis
+ */
+#ifdef _RPC_THREAD_SAFE_
+struct rpc_thread_variables {
+	fd_set		svc_fdset_s;		/* Global, rpc_common.c */
+	struct rpc_createerr rpc_createerr_s;	/* Global, rpc_common.c */
+	struct pollfd	*svc_pollfd_s;		/* Global, rpc_common.c */
+	int		svc_max_pollfd_s;	/* Global, rpc_common.c */
+
+	void		*authnone_private_s;	/* auth_none.c */
+
+	void		*clnt_perr_buf_s;	/* clnt_perr.c */
+
+	void		*clntraw_private_s;	/* clnt_raw.c */
+
+	void		*callrpc_private_s;	/* clnt_simp.c */
+
+	void		*key_call_private_s;	/* key_call.c */
+
+	void		*authdes_cache_s;	/* svcauth_des.c */
+	void		*authdes_lru_s;		/* svcauth_des.c */
+
+	void		*svc_xports_s;		/* svc.c */
+	void		*svc_head_s;		/* svc.c */
+
+	void		*svcraw_private_s;	/* svc_raw.c */
+
+	void		*svcsimple_proglst_s;	/* svc_simple.c */
+	void		*svcsimple_transp_s;	/* svc_simple.c */
+};
+
+extern struct rpc_thread_variables *__rpc_thread_variables(void)
+     __attribute__ ((const));
+extern void __rpc_thread_svc_cleanup (void);
+extern void __rpc_thread_clnt_cleanup (void);
+extern void __rpc_thread_key_cleanup (void);
+
+extern void __rpc_thread_destroy (void);
+
+#define RPC_THREAD_VARIABLE(x) (__rpc_thread_variables()->x)
+
+/*
+ * Global variables
+ */
+#define svc_fdset RPC_THREAD_VARIABLE(svc_fdset_s)
+#define rpc_createerr RPC_THREAD_VARIABLE(rpc_createerr_s)
+#define svc_pollfd RPC_THREAD_VARIABLE(svc_pollfd_s)
+#define svc_max_pollfd RPC_THREAD_VARIABLE(svc_max_pollfd_s)
+
+#endif /* _RPC_THREAD_SAFE_ */
+
 #endif
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index f4e37b4649..21402189c9 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,7 @@
+2001-03-20  Ulrich Drepper  <drepper@redhat.com>
+
+	* cancel.c (__pthread_perform_cleanup): Call __rpc_thread_destroy.
+
 2001-03-18  Ulrich Drepper  <drepper@redhat.com>
 
 	* Makefile: When generating DSO link with libc_nonshared.a.
diff --git a/linuxthreads/cancel.c b/linuxthreads/cancel.c
index b05d8bf66e..0ae0d12887 100644
--- a/linuxthreads/cancel.c
+++ b/linuxthreads/cancel.c
@@ -15,6 +15,7 @@
 /* Thread cancellation */
 
 #include <errno.h>
+#include <rpc/rpc.h>
 #include "pthread.h"
 #include "internals.h"
 #include "spinlock.h"
@@ -163,6 +164,10 @@ void __pthread_perform_cleanup(void)
   struct _pthread_cleanup_buffer * c;
   for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
     c->__routine(c->__arg);
+
+  /* And the TSD which needs special help.  */
+  if (THREAD_GETMEM(self, p_libc_specific[_LIBC_TSD_KEY_RPC_VARS]) != NULL)
+    __rpc_thread_destroy ();
 }
 
 #ifndef SHARED