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/timerdrv.h> |
---|
21 | |
---|
22 | /* forward declarations to avoid warnings */ |
---|
23 | void *POSIX_Init(void *argument); |
---|
24 | void benchmark_create_cond_var(void); |
---|
25 | void benchmark_destroy_cond_var(void); |
---|
26 | |
---|
27 | pthread_cond_t mycondvar; |
---|
28 | |
---|
29 | void benchmark_create_cond_var(void) |
---|
30 | { |
---|
31 | long end_time; |
---|
32 | int status; |
---|
33 | |
---|
34 | benchmark_timer_initialize(); |
---|
35 | status = pthread_cond_init(&mycondvar, NULL); |
---|
36 | end_time = benchmark_timer_read(); |
---|
37 | rtems_test_assert( status == 0 ); |
---|
38 | |
---|
39 | put_time( |
---|
40 | "pthread_cond_init: only case", |
---|
41 | end_time, |
---|
42 | 1, |
---|
43 | 0, |
---|
44 | 0 |
---|
45 | ); |
---|
46 | } |
---|
47 | |
---|
48 | void benchmark_destroy_cond_var(void) |
---|
49 | { |
---|
50 | long end_time; |
---|
51 | int status; |
---|
52 | |
---|
53 | benchmark_timer_initialize(); |
---|
54 | status = pthread_cond_destroy(&mycondvar); |
---|
55 | end_time = benchmark_timer_read(); |
---|
56 | rtems_test_assert( status == 0 ); |
---|
57 | |
---|
58 | put_time( |
---|
59 | "pthread_cond_destroy: only case", |
---|
60 | end_time, |
---|
61 | 1, |
---|
62 | 0, |
---|
63 | 0 |
---|
64 | ); |
---|
65 | } |
---|
66 | |
---|
67 | void *POSIX_Init( |
---|
68 | void *argument |
---|
69 | ) |
---|
70 | { |
---|
71 | puts( "\n\n*** POSIX TIME TEST PSXTMCOND01 ***" ); |
---|
72 | |
---|
73 | benchmark_create_cond_var(); |
---|
74 | benchmark_destroy_cond_var(); |
---|
75 | |
---|
76 | puts( "*** END OF POSIX TIME TEST PSXTMCOND01 ***" ); |
---|
77 | rtems_test_exit(0); |
---|
78 | } |
---|
79 | |
---|
80 | /* configuration information */ |
---|
81 | |
---|
82 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
83 | #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER |
---|
84 | |
---|
85 | /* configure an instance of the condition variable created and destroyed */ |
---|
86 | #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1 |
---|
87 | |
---|
88 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
89 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
90 | |
---|
91 | #define CONFIGURE_INIT |
---|
92 | |
---|
93 | #include <rtems/confdefs.h> |
---|
94 | /* end of file */ |
---|