From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nils Durner Newsgroups: gmane.lisp.guile.bugs Subject: [Patch] --with-threads on MinGW Date: Sun, 03 Dec 2006 19:26:07 +0100 Message-ID: <457316BF.6090003@web.de> NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080406090604040904050305" X-Trace: sea.gmane.org 1165170463 32127 80.91.229.10 (3 Dec 2006 18:27:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 3 Dec 2006 18:27:43 +0000 (UTC) Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Dec 03 19:27:42 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 1Gqw3x-0001LM-2E for guile-bugs@m.gmane.org; Sun, 03 Dec 2006 19:27:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gqw3w-0004AT-IU for guile-bugs@m.gmane.org; Sun, 03 Dec 2006 13:27:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gqw3u-00049E-1L for bug-guile@gnu.org; Sun, 03 Dec 2006 13:27:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gqw3s-000464-2G for bug-guile@gnu.org; Sun, 03 Dec 2006 13:27:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gqw3r-00045u-Tp for bug-guile@gnu.org; Sun, 03 Dec 2006 13:27:35 -0500 Original-Received: from [84.57.133.87] (helo=enterprise) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gqw3r-0006P6-Eo for bug-guile@gnu.org; Sun, 03 Dec 2006 13:27:35 -0500 Original-Received: from [192.168.0.3] (dell [192.168.0.3]) by enterprise (Postfix) with ESMTP id 9A00D46F9 for ; Sun, 3 Dec 2006 19:23:13 +0100 (CET) User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) Original-To: bug-guile@gnu.org X-Enigmail-Version: 0.94.0.0 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:3408 Archived-At: This is a multi-part message in MIME format. --------------080406090604040904050305 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Hi, the attached patch fixes building on MinGW with "--with-threads=pthreads" Nils Durner --------------080406090604040904050305 Content-Type: text/plain; name="guile_mingw01.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="guile_mingw01.diff" diff -Naur guile-1.8.1/libguile/gen-scmconfig.c guile-1.8.1.nd/libguile/gen-scmconfig.c --- guile-1.8.1/libguile/gen-scmconfig.c Sun Aug 27 21:05:24 2006 +++ guile-1.8.1.nd/libguile/gen-scmconfig.c Sun Dec 3 14:50:05 2006 @@ -355,7 +355,7 @@ pf ("\n"); pf ("/* same as POSIX \"struct timespec\" -- always defined */\n"); -#ifdef HAVE_STRUCT_TIMESPEC +#if HAVE_STRUCT_TIMESPEC || SCM_I_GSC_USE_PTHREAD_THREADS pf ("typedef struct timespec scm_t_timespec;\n"); #else pf ("/* POSIX.4 structure for a time value. This is like a `struct timeval'" diff -Naur guile-1.8.1/libguile/scmsigs.c guile-1.8.1.nd/libguile/scmsigs.c --- guile-1.8.1/libguile/scmsigs.c Sat Feb 18 06:08:46 2006 +++ guile-1.8.1.nd/libguile/scmsigs.c Sun Dec 3 12:52:43 2006 @@ -46,11 +46,14 @@ #ifdef __MINGW32__ #include +#include +#include #define alarm(sec) (0) /* This weird comma expression is because Sleep is void under Windows. */ #define sleep(sec) (Sleep ((sec) * 1000), 0) #define usleep(usec) (Sleep ((usec) / 1000), 0) #define kill(pid, sig) raise (sig) +#define pipe(fd) _pipe (fd, 256, O_BINARY) #endif @@ -149,12 +152,15 @@ static SCM signal_delivery_thread (void *data) { - sigset_t all_sigs; int n, sig; char sigbyte; +#ifndef __MINGW32__ + sigset_t all_sigs; + sigfillset (&all_sigs); scm_i_pthread_sigmask (SIG_SETMASK, &all_sigs, NULL); +#endif while (1) { diff -Naur guile-1.8.1/libguile/threads.c guile-1.8.1.nd/libguile/threads.c --- guile-1.8.1/libguile/threads.c Sat Jul 29 18:00:17 2006 +++ guile-1.8.1.nd/libguile/threads.c Sun Dec 3 15:42:05 2006 @@ -143,7 +143,13 @@ { scm_i_thread *t = SCM_I_THREAD_DATA (exp); scm_puts ("#pthread, 10, port); + scm_uintprint ((size_t) +#ifndef __MINGW32__ + t->pthread, +#else + t->pthread.p, +#endif + 10, port); scm_puts (" (", port); scm_uintprint ((scm_t_bits)t, 16, port); scm_puts (")>", port); @@ -572,13 +578,16 @@ #if SCM_USE_PTHREAD_THREADS /* pthread_getattr_np not available on MacOS X and Solaris 10. */ -#if HAVE_PTHREAD_ATTR_GETSTACK && HAVE_PTHREAD_GETATTR_NP +#if (HAVE_PTHREAD_ATTR_GETSTACK && HAVE_PTHREAD_GETATTR_NP) || __MINGW32__ #define HAVE_GET_THREAD_STACK_BASE static SCM_STACKITEM * get_thread_stack_base () { +#ifdef __MINGW32__ + return scm_get_stack_base (); +#else pthread_attr_t attr; void *start, *end; size_t size; @@ -604,8 +613,8 @@ return end; #endif } +#endif // MINGW } - #endif /* HAVE_PTHREAD_ATTR_GETSTACK && HAVE_PTHREAD_GETATTR_NP */ #else /* !SCM_USE_PTHREAD_THREADS */ --------------080406090604040904050305 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 --------------080406090604040904050305--