unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Cc: bug-guile@gnu.org
Subject: Re: [Patch] --with-threads on MinGW
Date: Thu, 14 Dec 2006 11:09:43 +1100	[thread overview]
Message-ID: <87zm9rmj7c.fsf@zip.com.au> (raw)
In-Reply-To: <878xhbnyfo.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 14 Dec 2006 10:55:23 +1100")

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

I wrote:
>
> I made the change below

Oops, too much cut and paste.  Actual change is:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: threads.c.print-struct.diff --]
[-- Type: text/x-diff, Size: 1375 bytes --]

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 ("#<thread ", port);
-  scm_uintprint ((size_t)t->pthread, 10, port);
+  scm_uintprint (id, 10, port);
   scm_puts (" (", port);
   scm_uintprint ((scm_t_bits)t, 16, port);
   scm_puts (")>", port);

[-- Attachment #3: Type: text/plain, Size: 137 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile

  reply	other threads:[~2006-12-14  0:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-03 18:26 [Patch] --with-threads on MinGW Nils Durner
2006-12-04  0:31 ` Kevin Ryde
2006-12-04 21:18   ` Nils Durner
2006-12-13 23:29     ` Kevin Ryde
2006-12-13 23:55     ` Kevin Ryde
2006-12-14  0:09       ` Kevin Ryde [this message]
2006-12-14 22:12       ` Nils Durner
2006-12-15  0:24         ` Kevin Ryde
2006-12-14  0:40     ` Kevin Ryde
2006-12-14  0:12 ` Kevin Ryde
2006-12-14 21:42   ` Nils Durner
2006-12-15  0:25     ` Kevin Ryde
2006-12-27  0:10       ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zm9rmj7c.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=bug-guile@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).