#if defined(AFS_PTHREAD_ENV)
EXT pthread_key_t rx_thread_id_key;
+/* keep track of pthread numbers - protected by rx_stats_mutex,
+ except in rx_Init() before mutex exists! */
+EXT int rxi_pthread_hinum INIT(0);
#endif
#if defined(RX_ENABLE_LOCKS)
printf("Unable to Create Rx server thread\n");
exit(1);
}
+ MUTEX_ENTER(&rx_stats_mutex);
+ ++rxi_pthread_hinum;
+ MUTEX_EXIT(&rx_stats_mutex);
AFS_SIGSET_RESTORE();
}
printf("Unable to create Rx event handling thread\n");
exit(1);
}
+ MUTEX_ENTER(&rx_stats_mutex);
+ ++rxi_pthread_hinum;
+ MUTEX_EXIT(&rx_stats_mutex);
AFS_SIGSET_RESTORE();
assert(pthread_mutex_lock(&listener_mutex)==0);
printf("Unable to create socket listener thread\n");
exit(1);
}
+ ++rxi_pthread_hinum;
AFS_SIGSET_RESTORE();
return 0;
}
} /*CheckAdminName*/
+static void setThreadId(char *s)
+{
+#ifdef AFS_PTHREAD_ENV
+ /* set our 'thread-id' so that the host hold table works */
+ MUTEX_ENTER(&rx_stats_mutex); /* protects rxi_pthread_hinum */
+ ++rxi_pthread_hinum;
+ pthread_setspecific(rx_thread_id_key, (void *)rxi_pthread_hinum);
+ MUTEX_EXIT(&rx_stats_mutex);
+ ViceLog(0,("Set thread id %d for '%s'\n", pthread_getspecific(rx_thread_id_key), s));
+#endif
+}
+
/* This LWP does things roughly every 5 minutes */
static void FiveMinuteCheckLWP()
{
char tbuffer[32];
ViceLog(1, ("Starting five minute check process\n"));
+ setThreadId("FiveMinuteCheckLWP");
while (1) {
#ifdef AFS_PTHREAD_ENV
sleep(fiveminutes);
static void HostCheckLWP()
{
ViceLog(1, ("Starting Host check process\n"));
+ setThreadId("HostCheckLWP");
while(1) {
#ifdef AFS_PTHREAD_ENV
sleep(fiveminutes);