]> err.no Git - varnish/commitdiff
Instead of incorrectly assuming that a pthread_t can be meaningfully cast
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 24 Jul 2007 14:25:54 +0000 (14:25 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 24 Jul 2007 14:25:54 +0000 (14:25 +0000)
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

varnish-cache/bin/varnishreplay/varnishreplay.c

index 45726a96bffe88c089eaf61836f31a6126d57a80..1b86efe690fb7c49e2474e8277243e7ad16f4b48 100644 (file)
@@ -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]);
 }