source: rtems/testsuites/psxtmtests/psxtmcond01/init.c @ 5222488

5
Last change on this file since 5222488 was 5222488, checked in by Sebastian Huber <sebastian.huber@…>, on 09/26/17 at 05:49:17

posix: Implement self-contained POSIX condvar

POSIX condition variables are now available in all configurations and no
longer depend on --enable-posix.

Update #2514.
Update #3113.

  • Property mode set to 100644
File size: 1.8 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 <coverhd.h>
15#include <tmacros.h>
16#include <timesys.h>
17#include "test_support.h"
18#include <pthread.h>
19#include <sched.h>
20#include <rtems/btimer.h>
21
22const char rtems_test_name[] = "PSXTMCOND 01";
23
24/* forward declarations to avoid warnings */
25void *POSIX_Init(void *argument);
26void benchmark_create_cond_var(void);
27void benchmark_destroy_cond_var(void);
28
29pthread_cond_t mycondvar;
30
31void benchmark_create_cond_var(void)
32{
33  uint32_t end_time;
34  int      status;
35
36  benchmark_timer_initialize();
37  status = pthread_cond_init(&mycondvar, NULL);
38  end_time = benchmark_timer_read();
39  rtems_test_assert( status == 0 );
40
41  put_time(
42    "pthread_cond_init: only case",
43    end_time,
44    1,
45    0,
46    0
47  );
48}
49
50void benchmark_destroy_cond_var(void)
51{
52  uint32_t end_time;
53  int      status;
54
55  benchmark_timer_initialize();
56  status = pthread_cond_destroy(&mycondvar);
57  end_time = benchmark_timer_read();
58  rtems_test_assert( status == 0 );
59
60  put_time(
61    "pthread_cond_destroy: only case",
62    end_time,
63    1,
64    0,
65    0
66  );
67}
68
69void *POSIX_Init(
70  void *argument
71)
72{
73  TEST_BEGIN();
74
75  benchmark_create_cond_var();
76  benchmark_destroy_cond_var();
77
78  TEST_END();
79  rtems_test_exit(0);
80}
81
82/* configuration information */
83
84#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
85#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
86
87/* configure an instance of the condition variable created and destroyed */
88
89#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
90#define CONFIGURE_POSIX_INIT_THREAD_TABLE
91
92#define CONFIGURE_INIT
93
94#include <rtems/confdefs.h>
95/* end of file */
Note: See TracBrowser for help on using the repository browser.