Skip to content

Commit 14fc9cd

Browse files
committed
Fix thread termination on OSX
1 parent f3b61c1 commit 14fc9cd

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
Let thread-terminate! sends the signal again if thread is too busy
55
to call Scm_SigCheck(), which makes the thread exit.
66
https://github.com/shirok/Gauche/issues/1106
7+
* src/gauche/pthread.h (GAUCHE_PTHREAD_SIGNAL): Use SIGUSR1 for
8+
thread termination singal on OSX, for it does not have real-time
9+
signals. (OSX does no use signals but use thread_suspend /
10+
thread_resume in GC.)
711
* src/libextra.scm, test/thread-termination.scm: Add procedures
812
specifically made to test thread-termination-by-signal behavior.
913

src/gauche/pthread.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ typedef pthread_t ScmInternalThread;
7878
provide them (on cygwin, SIGRTMIN == SIGRTMAX). We use SIGPWR
7979
instead.
8080
*/
81-
#if defined(SIGRTMIN) && !defined(GAUCHE_PTHREAD_SIGNAL)
82-
# if !defined(__CYGWIN__)
83-
# define GAUCHE_PTHREAD_SIGNAL (SIGRTMIN+5)
84-
# else
85-
# define GAUCHE_PTHREAD_SIGNAL SIGPWR
81+
#if !defined(GAUCHE_PTHREAD_SIGNAL)
82+
# if defined(SIGRTMIN)
83+
# if !defined(__CYGWIN__)
84+
# define GAUCHE_PTHREAD_SIGNAL (SIGRTMIN+5)
85+
# else
86+
# define GAUCHE_PTHREAD_SIGNAL SIGPWR
87+
# endif
88+
# elif defined(__APPLE__)
89+
# define GAUCHE_PTHREAD_SIGNAL SIGUSR1
8690
# endif
87-
#endif /*defined(SIGRTMIN) && !defined(GAUCHE_PTHREAD_SIGNAL)*/
91+
#endif /*!defined(GAUCHE_PTHREAD_SIGNAL)*/
92+
8893

8994
/* ScmInternalMutex - a mutex structure.
9095

0 commit comments

Comments
 (0)