mirror of
git://repo.or.cz/tinycc.git
synced 2026-07-04 02:18:50 +08:00
Fix fork problem 114_bound_signal
There is a race condition in old libc in fork(). The result was that 'end' was sometimes printed twice. This did not happen with glibc-2.32.
This commit is contained in:
parent
54b4aa3cd6
commit
08d8015750
@ -116,8 +116,6 @@ main (void)
|
|||||||
while (time(NULL) < end) ;
|
while (time(NULL) < end) ;
|
||||||
run = 0;
|
run = 0;
|
||||||
|
|
||||||
printf ("end\n"); fflush(stdout);
|
|
||||||
|
|
||||||
pthread_join(id1, NULL);
|
pthread_join(id1, NULL);
|
||||||
pthread_join(id2, NULL);
|
pthread_join(id2, NULL);
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
@ -126,6 +124,8 @@ main (void)
|
|||||||
sem_destroy (&sem);
|
sem_destroy (&sem);
|
||||||
sem_destroy (&sem_child);
|
sem_destroy (&sem_child);
|
||||||
|
|
||||||
|
printf ("end\n"); fflush(stdout);
|
||||||
|
|
||||||
sigemptyset (&m);
|
sigemptyset (&m);
|
||||||
sigprocmask (SIG_SETMASK, &m, NULL);
|
sigprocmask (SIG_SETMASK, &m, NULL);
|
||||||
if (sigsetjmp (sj, 0) == 0)
|
if (sigsetjmp (sj, 0) == 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user