OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [linux/] [linuxthreads/] [joinrace.c] - Blame information for rev 301

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Test case by Permaine Cheung <pcheung@cygnus.com>.  */
2
 
3
#include <errno.h>
4
#include <pthread.h>
5
#include <stdio.h>
6
#include <stdlib.h>
7
 
8
static void *
9
sub1 (void *arg)
10
{
11
  /* Nothing.  */
12
  return NULL;
13
}
14
 
15
int
16
main (void)
17
{
18
  int istatus;
19
  int policy;
20
  int cnt;
21
  pthread_t thread1;
22
  struct sched_param spresult1, sp1;
23
 
24
  for (cnt = 0; cnt < 100; ++cnt)
25
    {
26
      printf ("Round %d\n", cnt);
27
 
28
      pthread_create (&thread1, NULL, &sub1, NULL);
29
      pthread_join (thread1, NULL);
30
 
31
      istatus = pthread_getschedparam (thread1, &policy, &spresult1);
32
      if (istatus != ESRCH)
33
        {
34
          printf ("pthread_getschedparam returns: %d\n", istatus);
35
          return 1;
36
        }
37
 
38
      sp1.__sched_priority = 0;
39
      istatus = pthread_setschedparam (thread1, SCHED_OTHER, &sp1);
40
      if (istatus != ESRCH)
41
        {
42
          printf ("pthread_setschedparam returns: %d\n", istatus);
43
          return 2;
44
        }
45
    }
46
 
47
  return 0;
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.