1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
$NetBSD: patch-ag,v 1.5 2005/11/04 21:21:02 tonio Exp $
--- kaffe/kaffevm/systems/unix-pthreads/thread-impl.c.orig 2005-08-20 14:31:02.000000000 +0200
+++ kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
@@ -415,7 +415,7 @@ tInitSignalHandlers (void)
saResume.sa_flags = 0; /* Note that we do not want restart here. */
saResume.sa_handler = resume_signal_handler;
saResume.sa_mask = saSuspend.sa_mask;
-#ifndef KAFFE_BOEHM_GC
+#if !defined(KAFFE_BOEHM_GC) && !defined(KAFFE_BUGGY_NETBSD_SIGWAIT)
sigaction( sigResume, &saResume, NULL);
#endif
@@ -1275,7 +1275,12 @@ void KaffePThread_WaitForResume(int rele
/* freeze until we get a subsequent sigResume */
while( cur->suspendState == SS_SUSPENDED )
- sigwait( &suspendSet, &s);
+ {
+ sigwait( &suspendSet, &s);
+ /* Post something even if it is not the right thread. */
+ if (cur->suspendState == SS_SUSPENDED)
+ repsem_post(&critSem);
+ }
DBG( JTHREADDETAIL, dprintf("sigwait return: %p\n", cur));
@@ -1497,13 +1502,17 @@ jthread_unsuspendall (void)
if ((t->blockState & (BS_SYSCALL|BS_CV|BS_CV_TO|BS_MUTEX)) == 0)
{
DBG (JTHREADDETAIL, dprintf(" sending sigResume\n"));
- status = pthread_kill( t->tid, sigResume);
- if ( status )
+ do
{
- DBG( JTHREAD, dprintf("error sending RESUME signal to %p: %d\n", t, status));
- }
- /* ack wait workaround, see jthread_suspendall remarks */
- repsem_wait( &critSem);
+ status = pthread_kill( t->tid, sigResume);
+ if ( status )
+ {
+ DBG( JTHREAD, dprintf("error sending RESUME signal to %p: %d\n", t, status));
+ }
+ /* ack wait workaround, see jthread_suspendall remarks */
+ repsem_wait( &critSem);
+ }
+ while (t->suspendState == SS_PENDING_RESUME);
}
else
{
|