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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [test/] [pthread/] [ex6.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
#include <errno.h>
2
#include <stdio.h>
3
#include <string.h>
4
#include <pthread.h>
5
#include <unistd.h>
6
 
7
void *
8
test_thread (void *v_param)
9
{
10
  return NULL;
11
}
12
 
13
int
14
main (void)
15
{
16
  unsigned long count;
17
 
18
  setvbuf (stdout, NULL, _IONBF, 0);
19
 
20
  for (count = 0; count < 2000; ++count)
21
    {
22
      pthread_t thread;
23
      int status;
24
 
25
      status = pthread_create (&thread, NULL, test_thread, NULL);
26
      if (status != 0)
27
        {
28
          printf ("status = %d, count = %lu: %s\n", status, count,
29
                  strerror (errno));
30
          return 1;
31
        }
32
      else
33
        {
34
          printf ("count = %lu\n", count);
35
        }
36
      /* pthread_detach (thread); */
37
      pthread_join (thread, NULL);
38
      usleep (10);
39
    }
40
  return 0;
41
}

powered by: WebSVN 2.1.0

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