URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 24 |
Rev 33 |
/* Check that TRT happens at an non-abort ignored signal, more than one thread.
|
/* Check that TRT happens at an non-abort ignored signal, more than one thread.
|
#notarget: cris*-*-elf
|
#notarget: cris*-*-elf
|
#cc: additional_flags=-pthread
|
#cc: additional_flags=-pthread
|
*/
|
*/
|
|
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <stddef.h>
|
#include <stddef.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
#include <pthread.h>
|
#include <pthread.h>
|
#include <sys/types.h>
|
#include <sys/types.h>
|
#include <signal.h>
|
#include <signal.h>
|
|
|
static void *
|
static void *
|
process (void *arg)
|
process (void *arg)
|
{
|
{
|
int i;
|
int i;
|
for (i = 0; i < 100; i++)
|
for (i = 0; i < 100; i++)
|
sched_yield ();
|
sched_yield ();
|
return NULL;
|
return NULL;
|
}
|
}
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
pthread_t th_a;
|
pthread_t th_a;
|
int retcode;
|
int retcode;
|
void *retval;
|
void *retval;
|
signal (SIGALRM, SIG_IGN);
|
signal (SIGALRM, SIG_IGN);
|
if (pthread_create (&th_a, NULL, process, (void *) "a") == 0)
|
if (pthread_create (&th_a, NULL, process, (void *) "a") == 0)
|
kill (getpid (), SIGALRM);
|
kill (getpid (), SIGALRM);
|
retcode = pthread_join (th_a, &retval);
|
retcode = pthread_join (th_a, &retval);
|
if (retcode != 0 || retval != NULL)
|
if (retcode != 0 || retval != NULL)
|
abort ();
|
abort ();
|
printf ("pass\n");
|
printf ("pass\n");
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.