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

4.115
Last change on this file since dfe9034 was dfe9034, checked in by Joel Sherrill <joel.sherrill@…>, on 06/22/11 at 20:53:33

2011-06-22 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac: Add test case for sleep - blocking.
  • psxtmsleep02/.cvsignore, psxtmsleep02/Makefile.am, psxtmsleep02/init.c, psxtmsleep02/psxtmsleep02.doc: New files.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
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.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <timesys.h>
17#include <rtems/timerdrv.h>
18#include "test_support.h"
19
20#include <pthread.h>
21
22void *Low(
23  void *argument
24)
25{
26  long end_time;
27
28  end_time = benchmark_timer_read();
29
30  put_time(
31    "sleep - blocking",
32    end_time,
33    OPERATION_COUNT,
34    0,
35    0
36  );
37
38  puts( "*** END OF POSIX TIME TEST sleep - blocking ***" );
39
40  rtems_test_exit( 0 );
41  return NULL;
42}
43
44void *Middle(
45  void *argument
46)
47{
48  sleep(1);
49  return NULL;
50}
51
52void *POSIX_Init(
53  void *argument
54)
55{
56  int        i;
57  int        status;
58  pthread_t  threadId;
59
60  puts( "\n\n*** POSIX TIME TEST sleep - blocking ***" );
61
62  for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) {
63    status = pthread_create( &threadId, NULL, Middle, NULL );
64    rtems_test_assert( !status );
65  }
66 
67  status = pthread_create( &threadId, NULL, Low, NULL );
68  rtems_test_assert( !status );
69
70  /* start the timer and switch through all the other tasks */
71  benchmark_timer_initialize();
72  sleep(1);
73  return NULL;
74}
75
76/* configuration information */
77
78#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
79#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
80
81#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
82#define CONFIGURE_POSIX_INIT_THREAD_TABLE
83
84#define CONFIGURE_INIT
85
86#include <rtems/confdefs.h>
87  /* end of file */
Note: See TracBrowser for help on using the repository browser.