[master] 703e7e6 Cast thread_t's all over the place in order to be able to printf them.

Poul-Henning Kamp phk at varnish-cache.org
Thu Jan 10 10:32:57 CET 2013


commit 703e7e67e93a7c46f43ca37ff405aacba26990f8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 10 09:31:56 2013 +0000

    Cast thread_t's all over the place in order to be able to printf them.
    
    A more kosher solution might be pthread_getthreadid_np() on the platforms
    which support it, but I can't be bothered for three debugging printfs :-)
    
    Submitted by:	Nils Goroll
    Fixes		#932

diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index d8d19d5..d8f2877 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -182,7 +182,7 @@ thread_log(int lvl, int errcode, const char *fmt, ...)
 	if (lvl > debug)
 		return;
 	pthread_mutex_lock(&log_mutex);
-	fprintf(stderr, "%p ", (void *)pthread_self());
+	fprintf(stderr, "%p ", (void *)(uintptr_t)pthread_self());
 	va_start(ap, fmt);
 	vfprintf(stderr, fmt, ap);
 	va_end(ap);
@@ -276,7 +276,7 @@ thread_get(int fd, void *(*thread_main)(void *))
 		} else {
 			threads[fd]->fd = fd;
 			thread_log(0, 0, "thread %p:%d started",
-			    (void *)threads[fd]->thread_id, fd);
+			    (void *)(uintptr_t)threads[fd]->thread_id, fd);
 		}
 	}
 	if (threads[fd] == THREAD_FAIL)
@@ -301,7 +301,7 @@ thread_close(int fd)
 	mailbox_close(&threads[fd]->mbox);
 	pthread_join(threads[fd]->thread_id, NULL);
 	thread_log(0, 0, "thread %p stopped",
-	    (void *)threads[fd]->thread_id);
+	    (void *)(uintptr_t)threads[fd]->thread_id);
 	thread_clear(threads[fd]);
 	mailbox_destroy(&threads[fd]->mbox);
 	freez(threads[fd]);



More information about the varnish-commit mailing list