Skip to content

Commit 7906735

Browse files
committed
Workaround for hanging benchmarks
The alarm signal is not delivered unless we call some kernel function.
1 parent 0662b56 commit 7906735

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

crypt/speeds.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <signal.h>
1212
#include <stdio.h>
1313
#include <stdlib.h>
14+
#include <sched.h>
1415

1516
/* Some modifications for the MiNTLib. Especially also test MD5
1617
encryption. */
@@ -159,6 +160,7 @@ main ()
159160
#else
160161
s = crypt (s, SALT);
161162
#endif
163+
sched_yield();
162164
}
163165

164166
return 1;

time/test-clock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <time.h>
44
#include <unistd.h>
55
#include <stdlib.h>
6+
#include <sched.h>
67

78
volatile int gotit = 0;
89

@@ -27,7 +28,7 @@ main (int argc, char ** argv)
2728
}
2829
alarm(1);
2930
start = clock ();
30-
while (!gotit);
31+
while (!gotit) sched_yield();
3132
stop = clock ();
3233

3334
printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",

0 commit comments

Comments
 (0)