[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patch] --with-threads on MinGW
From: |
Nils Durner |
Subject: |
[Patch] --with-threads on MinGW |
Date: |
Sun, 03 Dec 2006 19:26:07 +0100 |
User-agent: |
Thunderbird 1.5.0.8 (Windows/20061025) |
Hi,
the attached patch fixes building on MinGW with "--with-threads=pthreads"
Nils Durner
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
@@ -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 */
- [Patch] --with-threads on MinGW,
Nils Durner <=
- Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/03
- Re: [Patch] --with-threads on MinGW, Nils Durner, 2006/12/04
- Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/13
- Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/13
- Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/13
- Re: [Patch] --with-threads on MinGW, Nils Durner, 2006/12/14
- Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/14
- Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/13
Re: [Patch] --with-threads on MinGW, Kevin Ryde, 2006/12/13