Index: threads.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/threads.c,v retrieving revision 1.84.2.5 retrieving revision 1.84.2.6 diff -u -r1.84.2.5 -r1.84.2.6 --- threads.c 25 Jul 2006 00:09:30 -0000 1.84.2.5 +++ threads.c 13 Dec 2006 23:55:51 -0000 1.84.2.6 @@ -141,9 +141,32 @@ static int thread_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { + /* On a Gnu system pthread_t is an unsigned long, but on mingw it's a + struct. A cast like "(unsigned long) t->pthread" is a syntax error in + the struct case, hence we go via a union, and extract according to the + size of pthread_t. */ + union { + pthread_t p; + unsigned short us; + unsigned int ui; + unsigned long ul; + scm_t_uintmax um; + } u; scm_i_thread *t = SCM_I_THREAD_DATA (exp); + scm_i_pthread_t p = t->pthread; + scm_t_uintmax id; + u.p = p; + if (sizeof (p) == sizeof (unsigned short)) + id = u.us; + else if (sizeof (p) == sizeof (unsigned int)) + id = u.ui; + else if (sizeof (p) == sizeof (unsigned long)) + id = u.ul; + else + id = u.um; + scm_puts ("#pthread, 10, port); + scm_uintprint (id, 10, port); scm_puts (" (", port); scm_uintprint ((scm_t_bits)t, 16, port); scm_puts (")>", port);