source: rtems/testsuites/psxtmtests/psxtmsleep02/init.c @ fd46711

4.115
Last change on this file since fd46711 was fd46711, checked in by bjorn larsson <bjornlarsson@…>, on 03/21/14 at 20:35:26

psxtmtests: Add test.h support

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2013.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <timesys.h>
15#include <rtems/timerdrv.h>
16#include "test_support.h"
17
18#include <pthread.h>
19
20const char rtems_test_name[] = "PSXTMSLEEP 02";
21
22/* forward declarations to avoid warnings */
23void *POSIX_Init(void *argument);
24void *Middle(void *argument);
25void *Low(void *argument);
26
27void *Low(
28  void *argument
29)
30{
31  benchmark_timer_t end_time;
32
33  end_time = benchmark_timer_read();
34
35  put_time(
36    "sleep: blocking",
37    end_time,
38    OPERATION_COUNT,
39    0,
40    0
41  );
42
43  TEST_END();
44
45  rtems_test_exit( 0 );
46  return NULL;
47}
48
49void *Middle(
50  void *argument
51)
52{
53  sleep(1);
54  return NULL;
55}
56
57void *POSIX_Init(
58  void *argument
59)
60{
61  int        i;
62  int        status;
63  pthread_t  threadId;
64
65  TEST_BEGIN();
66
67  for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) {
68    status = pthread_create( &threadId, NULL, Middle, NULL );
69    rtems_test_assert( !status );
70  }
71 
72  status = pthread_create( &threadId, NULL, Low, NULL );
73  rtems_test_assert( !status );
74
75  /* start the timer and switch through all the other tasks */
76  benchmark_timer_initialize();
77  sleep(1);
78  return NULL;
79}
80
81/* configuration information */
82
83#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
84#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
85
86#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
87#define CONFIGURE_POSIX_INIT_THREAD_TABLE
88
89#define CONFIGURE_INIT
90
91#include <rtems/confdefs.h>
92  /* end of file */
Note: See TracBrowser for help on using the repository browser.