From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.bugs Subject: Re: [Patch] --with-threads on MinGW Date: Thu, 14 Dec 2006 11:09:43 +1100 Message-ID: <87zm9rmj7c.fsf@zip.com.au> References: <457316BF.6090003@web.de> <87veks33jf.fsf@zip.com.au> <457490A5.80601@web.de> <878xhbnyfo.fsf@zip.com.au> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1166055001 14327 80.91.229.10 (14 Dec 2006 00:10:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Dec 2006 00:10:01 +0000 (UTC) Cc: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Dec 14 01:09:58 2006 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GueAd-0006Ev-Jk for guile-bugs@m.gmane.org; Thu, 14 Dec 2006 01:09:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GueAd-0005Bh-2P for guile-bugs@m.gmane.org; Wed, 13 Dec 2006 19:09:55 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GueAZ-0005BA-1u for bug-guile@gnu.org; Wed, 13 Dec 2006 19:09:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GueAW-0005AP-Dc for bug-guile@gnu.org; Wed, 13 Dec 2006 19:09:49 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GueAV-0005A7-Px for bug-guile@gnu.org; Wed, 13 Dec 2006 19:09:47 -0500 Original-Received: from [61.8.2.231] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GueAV-0004lL-67 for bug-guile@gnu.org; Wed, 13 Dec 2006 19:09:47 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id B596C1113E5; Thu, 14 Dec 2006 11:09:43 +1100 (EST) Original-Received: from localhost (ppp245A.dyn.pacific.net.au [61.8.36.90]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id 36B918C34; Thu, 14 Dec 2006 11:09:44 +1100 (EST) Original-Received: from gg by localhost with local (Exim 4.63) (envelope-from ) id 1GueAR-0007Hf-Gj; Thu, 14 Dec 2006 11:09:43 +1100 Original-To: Nils Durner In-Reply-To: <878xhbnyfo.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 14 Dec 2006 10:55:23 +1100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3427 Archived-At: --=-=-= I wrote: > > I made the change below Oops, too much cut and paste. Actual change is: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=threads.c.print-struct.diff 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); --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://lists.gnu.org/mailman/listinfo/bug-guile --=-=-=--