unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [Patch] --with-threads on MinGW
@ 2006-12-03 18:26 Nils Durner
  2006-12-04  0:31 ` Kevin Ryde
  2006-12-14  0:12 ` Kevin Ryde
  0 siblings, 2 replies; 13+ messages in thread
From: Nils Durner @ 2006-12-03 18:26 UTC (permalink / raw)


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

Hi,

the attached patch fixes building on MinGW with "--with-threads=pthreads"


    Nils Durner

[-- Attachment #2: guile_mingw01.diff --]
[-- Type: text/plain, Size: 2650 bytes --]

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 <windows.h>
+#include <fcntl.h>
+#include <process.h>
 #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
 
 \f
@@ -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 ("#<thread ", port);
-  scm_uintprint ((size_t)t->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 */

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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-12-27  0:10 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).