[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. v2.1.0-74-g1b679a8
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. v2.1.0-74-g1b679a8 |
Date: |
Thu, 26 May 2011 16:44:23 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=1b679a82e1d87e8bf10033292de6e53309057217
The branch, master has been updated
via 1b679a82e1d87e8bf10033292de6e53309057217 (commit)
via ee395b7cfbd020338e4063fe5513945ddfda48eb (commit)
via af4081e9fd1d3bfaf4df906cac990c88e2e7cfa2 (commit)
via f4e45e91f265429ad1c42d3905dd3c05a0bc0924 (commit)
from 27583e746617ebb7351a05952c52331b81ddd70d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1b679a82e1d87e8bf10033292de6e53309057217
Author: Andy Wingo <address@hidden>
Date: Thu May 26 18:43:09 2011 +0200
remove gc pthread redirects entirely
* libguile/pthread-threads.h: As an experiment, just define
scm_i_pthread_create et al to their pthread_* functions, instead of
the GC_ ones. It seems sufficient, given that all uses of Guile have
to go through scm_with_guile anyway... Passes tests on my machine.
Committing to give buildbots a go at it.
commit ee395b7cfbd020338e4063fe5513945ddfda48eb
Merge: 27583e7 af4081e
Author: Andy Wingo <address@hidden>
Date: Thu May 26 18:30:37 2011 +0200
Merge remote-tracking branch 'origin/stable-2.0'
-----------------------------------------------------------------------
Summary of changes:
libguile/pthread-threads.h | 20 ++------------------
libguile/scmsigs.c | 36 ++++++++++++++++++++++++++++--------
module/ice-9/futures.scm | 37 +++++++++++++++++++++++--------------
3 files changed, 53 insertions(+), 40 deletions(-)
diff --git a/libguile/pthread-threads.h b/libguile/pthread-threads.h
index 4c67b18..b5fae4e 100644
--- a/libguile/pthread-threads.h
+++ b/libguile/pthread-threads.h
@@ -29,27 +29,15 @@
#include <pthread.h>
#include <sched.h>
-/* `libgc' defines wrapper procedures for pthread calls. */
-#include "libguile/bdw-gc.h"
-
/* Threads
*/
#define scm_i_pthread_t pthread_t
#define scm_i_pthread_self pthread_self
-#define scm_i_pthread_create GC_pthread_create
-#define scm_i_pthread_detach GC_pthread_detach
+#define scm_i_pthread_create pthread_create
+#define scm_i_pthread_detach pthread_detach
-#if SCM_HAVE_GC_PTHREAD_EXIT
-#define scm_i_pthread_exit GC_pthread_exit
-#else
#define scm_i_pthread_exit pthread_exit
-#endif
-
-#if SCM_HAVE_GC_PTHREAD_CANCEL
-#define scm_i_pthread_cancel GC_pthread_cancel
-#else
#define scm_i_pthread_cancel pthread_cancel
-#endif
#define scm_i_pthread_cleanup_push pthread_cleanup_push
#define scm_i_pthread_cleanup_pop pthread_cleanup_pop
@@ -57,11 +45,7 @@
/* Signals
*/
-#if SCM_HAVE_GC_PTHREAD_SIGMASK
-#define scm_i_pthread_sigmask GC_pthread_sigmask
-#else
#define scm_i_pthread_sigmask pthread_sigmask
-#endif
/* Mutexes
*/
diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index 699a6de..641d1b3 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2007,
2008, 2009, 2011 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -148,11 +148,28 @@ take_signal (int signum)
#endif
}
+struct signal_pipe_data
+{
+ char sigbyte;
+ ssize_t n;
+ int err;
+};
+
+static void*
+read_signal_pipe_data (void * data)
+{
+ struct signal_pipe_data *sdata = data;
+
+ sdata->n = read (signal_pipe[0], &sdata->sigbyte, 1);
+ sdata->err = errno;
+
+ return NULL;
+}
+
static SCM
signal_delivery_thread (void *data)
{
- int n, sig;
- char sigbyte;
+ int sig;
#if HAVE_PTHREAD_SIGMASK /* not on mingw, see notes above */
sigset_t all_sigs;
sigfillset (&all_sigs);
@@ -161,9 +178,12 @@ signal_delivery_thread (void *data)
while (1)
{
- n = read (signal_pipe[0], &sigbyte, 1);
- sig = sigbyte;
- if (n == 1 && sig >= 0 && sig < NSIG)
+ struct signal_pipe_data sigdata;
+
+ scm_without_guile (read_signal_pipe_data, &sigdata);
+
+ sig = sigdata.sigbyte;
+ if (sigdata.n == 1 && sig >= 0 && sig < NSIG)
{
SCM h, t;
@@ -172,9 +192,9 @@ signal_delivery_thread (void *data)
if (scm_is_true (h))
scm_system_async_mark_for_thread (h, t);
}
- else if (n == 0)
+ else if (sigdata.n == 0)
break; /* the signal pipe was closed. */
- else if (n < 0 && errno != EINTR)
+ else if (sigdata.n < 0 && sigdata.err != EINTR)
perror ("error in signal delivery thread");
}
diff --git a/module/ice-9/futures.scm b/module/ice-9/futures.scm
index 1aebaa6..012ebbf 100644
--- a/module/ice-9/futures.scm
+++ b/module/ice-9/futures.scm
@@ -1,6 +1,6 @@
;;; -*- mode: scheme; coding: utf-8; -*-
;;;
-;;; Copyright (C) 2010 Free Software Foundation, Inc.
+;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
@@ -54,6 +54,7 @@
"Return a new future for THUNK. Execution may start at any point
concurrently, or it can start at the time when the returned future is
touched."
+ (create-workers!)
(let ((future (%make-future thunk #f (make-mutex))))
(register-future! future)
future))
@@ -145,19 +146,27 @@ touched."
(- (current-processor-count) 1)
0))
-(define %workers
- ;; A dock of workers that stay here forever.
-
- ;; TODO
- ;; 1. Allocate lazily.
- ;; 2. Allow the pool to be shrunk, as in libgomp (though that we'd
- ;; need semaphores, which aren't yet in libguile!).
- ;; 3. Provide a `worker-count' fluid.
- (unfold (lambda (i) (>= i %worker-count))
- (lambda (i)
- (call-with-new-thread process-futures))
- 1+
- 0))
+;; A dock of workers that stay here forever.
+
+;; TODO
+;; 1. Allow the pool to be shrunk, as in libgomp (though that we'd
+;; need semaphores, which aren't yet in libguile!).
+;; 2. Provide a `worker-count' fluid.
+(define %workers '())
+
+(define (%create-workers!)
+ (lock-mutex %futures-mutex)
+ (set! %workers
+ (unfold (lambda (i) (>= i %worker-count))
+ (lambda (i)
+ (call-with-new-thread process-futures))
+ 1+
+ 0))
+ (set! create-workers! (lambda () #t))
+ (unlock-mutex %futures-mutex))
+
+(define create-workers!
+ (lambda () (%create-workers!)))
;;;
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. v2.1.0-74-g1b679a8,
Andy Wingo <=