source: rtems/testsuites/psxtmtests/psxtmbarrier01/init.c @ 8fbe2e6

4.115
Last change on this file since 8fbe2e6 was 8fbe2e6, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/14 at 13:59:49

Use correct prototype of benchmark_timer_read()

This change starts with removing the effectively empty file
timerdrv.h. The prototypes for benchmark_timer_XXX() were in
btimer.h which was not universally used. Thus every use of
timerdrv.h had to be changed to btimer.h. Then the prototypes
for benchmark_timer_read() had to be adjusted to return
benchmark_timer_t rather than int or uint32_t.

I took this opportunity to also correct the file headers to
separate the copyright from the file description comments which
is needed to ensure the copyright isn't propagated into Doxygen
output.

  • Property mode set to 100644
File size: 2.2 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/btimer.h>
16#include "test_support.h"
17#include <pthread.h>
18
19const char rtems_test_name[] = "PSXTMBARRIER 01";
20
21/* forward declarations to avoid warnings */
22void *POSIX_Init(void *argument);
23static void benchmark_pthread_barrier_init(void);
24
25pthread_barrier_t   barrier;
26
27static void benchmark_pthread_barrier_init(void)
28{
29  benchmark_timer_t end_time;
30  int                   status;
31  pthread_barrierattr_t attr;
32
33  /* initialize attr with default attributes
34   * for all of the attributes defined by the implementation
35   */
36  status = pthread_barrierattr_init( &attr );
37  rtems_test_assert( status == 0 );
38
39  benchmark_timer_initialize();
40    status = pthread_barrier_init( &barrier,&attr, 1 );
41  end_time = benchmark_timer_read();
42  rtems_test_assert( status == 0 );
43
44  put_time(
45    "pthread_barrier_init: only case",
46    end_time,
47    1,        /* Only executed once */
48    0,
49    0
50  );
51}
52
53static void benchmark_pthread_barrier_destroy(void)
54{
55  benchmark_timer_t end_time;
56  int  status;
57
58  benchmark_timer_initialize();
59    status = pthread_barrier_destroy( &barrier );
60  end_time = benchmark_timer_read();
61  rtems_test_assert( status == 0 );
62
63  put_time(
64    "pthread_barrier_destroy: only case",
65    end_time,
66    1,        /* Only executed once */
67    0,
68    0
69  );
70}
71
72void *POSIX_Init(
73  void *argument
74)
75{
76  TEST_BEGIN();
77
78  /* creating barrier with default properties */
79  benchmark_pthread_barrier_init();
80  /* destroying barrier */
81  benchmark_pthread_barrier_destroy();
82 
83  TEST_END();
84
85  rtems_test_exit(0);
86}
87
88/* configuration information */
89
90#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
91#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
92
93#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
94#define CONFIGURE_MAXIMUM_POSIX_BARRIERS    1
95#define CONFIGURE_POSIX_INIT_THREAD_TABLE
96
97#define CONFIGURE_INIT
98
99#include <rtems/confdefs.h>
100/* end of file */
Note: See TracBrowser for help on using the repository browser.