#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
afs_uint32 SHostAddrs[ADDRSPERSITE];
-#if defined(AFS_PTHREAD_ENV)
-static int
-threadNum(void)
-{
- return (intptr_t)pthread_getspecific(rx_thread_id_key);
-}
-#endif
-
/* check whether caller is authorized to manage RX statistics */
int
BU_rxstat_userok(struct rx_call *call)
srandom(1);
#ifdef AFS_PTHREAD_ENV
- SetLogThreadNumProgram( threadNum );
+ SetLogThreadNumProgram( rx_GetThreadNum );
#endif
/* process the user supplied args */
rx_identity_free @303
rx_SetBusyChannelError @304
+ rx_GetThreadNum @305
+ rx_SetThreadNum @306
; for performance testing
rx_TSFPQGlobSize @2001 DATA
extern afs_int32 rx_SetSecurityConfiguration(struct rx_service *service,
rx_securityConfigVariables type,
void *value);
+extern int rx_GetThreadNum(void);
+extern int rx_SetThreadNum(void);
void rxi_DebugInit(void);
void rxi_DebugPrint(char *format, ...)
#include "rx_clock.h"
#include "rx_atomic.h"
+static void rxi_SetThreadNum(int threadID);
+
/* Set rx_pthread_event_rescheduled if event_handler should just try
* again instead of sleeping.
*
/* osi_Assert(threadID != -1); */
/* osi_Assert(newcall != NULL); */
sock = OSI_NULLSOCKET;
- osi_Assert(pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)threadID) == 0);
+ rxi_SetThreadNum(threadID);
rxi_ServerProc(threadID, newcall, &sock);
/* osi_Assert(sock != OSI_NULLSOCKET); */
}
while (1) {
sock = OSI_NULLSOCKET;
- osi_Assert(pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)threadID) == 0);
+ rxi_SetThreadNum(threadID);
rxi_ServerProc(threadID, newcall, &sock);
/* osi_Assert(sock != OSI_NULLSOCKET); */
newcall = NULL;
#endif /* RX_ENABLE_TSFPQ */
return rx_ts_info;
}
+
+int
+rx_GetThreadNum(void) {
+ return (intptr_t)pthread_getspecific(rx_thread_id_key);
+}
+
+static void
+rxi_SetThreadNum(int threadID) {
+ osi_Assert(pthread_setspecific(rx_thread_id_key,
+ (void *)(intptr_t)threadID) == 0);
+}
+
+int
+rx_SetThreadNum(void) {
+ int threadId;
+
+ threadId = rx_NewThreadId();
+ rxi_SetThreadNum(threadId);
+ return threadId;
+}
+
#endif
}
-#if defined(AFS_PTHREAD_ENV)
-int
-threadNum(void)
-{
- return (intptr_t)pthread_getspecific(rx_thread_id_key);
-}
-#endif
-
#ifndef AFS_NT40_ENV
int
viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
setThreadId(char *s)
{
#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
+ int threadId;
+
/* set our 'thread-id' so that the host hold table works */
- pthread_setspecific(rx_thread_id_key,
- (void *)(intptr_t)rx_NewThreadId());
+ threadId = rx_SetThreadNum();
afs_pthread_setname_self(s);
- ViceLog(0,
- ("Set thread id %p for '%s'\n",
- pthread_getspecific(rx_thread_id_key), s));
+ ViceLog(0, ("Set thread id 0x%x for '%s'\n", threadId, s));
#endif
}
}
#ifdef AFS_PTHREAD_ENV
- SetLogThreadNumProgram( threadNum );
+ SetLogThreadNumProgram( rx_GetThreadNum );
#endif
/* initialize libacl routines */
#ifdef AFS_PTHREAD_ENV
/* set our 'thread-id' so that the host hold table works */
- tid = rx_NewThreadId();
- pthread_setspecific(rx_thread_id_key, (void *)(intptr_t)tid);
+ tid = rx_SetThreadNum();
Log("Set thread id %d for FSYNC_sync\n", tid);
#endif /* AFS_PTHREAD_ENV */
exit(code); \
}
-#if defined(AFS_PTHREAD_ENV)
-int
-threadNum(void)
-{
- return (intptr_t)pthread_getspecific(rx_thread_id_key);
-}
-#endif
-
static void
MyBeforeProc(struct rx_call *acall)
{
InitErrTabs();
#ifdef AFS_PTHREAD_ENV
- SetLogThreadNumProgram( threadNum );
+ SetLogThreadNumProgram( rx_GetThreadNum );
#endif
#ifdef AFS_NT40_ENV