From: des Date: Tue, 24 Jul 2007 14:25:54 +0000 (+0000) Subject: Instead of incorrectly assuming that a pthread_t can be meaningfully cast X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81e64db242992c329a5a6491ed641ed0fdfb4ad9;p=varnish Instead of incorrectly assuming that a pthread_t can be meaningfully cast to an unsigned int (which triggered warnings on some 64-bit platforms) and printed with %08lx, incorrectly assume that it can be meaningfully cast to a void * and printed with %p. While still incorrect in general terms, the latter turns out to be correct on the specific systems that we care about. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1754 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishreplay/varnishreplay.c b/varnish-cache/bin/varnishreplay/varnishreplay.c index 45726a96..1b86efe6 100644 --- a/varnish-cache/bin/varnishreplay/varnishreplay.c +++ b/varnish-cache/bin/varnishreplay/varnishreplay.c @@ -145,7 +145,7 @@ thread_log(int lvl, const char *fmt, ...) if (lvl > debug) return; pthread_mutex_lock(&log_mutex); - fprintf(stderr, "%08x ", (unsigned int)pthread_self()); + fprintf(stderr, "%p ", (void *)pthread_self()); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); @@ -183,8 +183,8 @@ thread_get(int fd, void *(*thread_main)(void *)) mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); } - thread_log(1, "thread %08x started\n", - (unsigned int)threads[fd]->thread_id); + thread_log(1, "thread %p started\n", + (void *)threads[fd]->thread_id); } return (threads[fd]); } @@ -204,8 +204,8 @@ thread_close(int fd) return; mailbox_close(&threads[fd]->mbox); pthread_join(threads[fd]->thread_id, NULL); - thread_log(1, "thread %08x stopped\n", - (unsigned int)threads[fd]->thread_id); + thread_log(1, "thread %p stopped\n", + (void *)threads[fd]->thread_id); mailbox_destroy(&threads[fd]->mbox); freez(threads[fd]); }