source:
rtems/testsuites/psxtmtests/psxtmmutex01/init.c
@
add2977
Last change on this file since add2977 was add2977, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/19/11 at 15:27:27 | |
---|---|
|
|
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 <errno.h> |
19 | #include <pthread.h> |
20 | #include "test_support.h" |
21 | |
22 | pthread_mutex_t MutexId; |
23 | |
24 | void test_mutex_create(void) |
25 | { |
26 | benchmark_timer_t end_time; |
27 | int status; |
28 | |
29 | benchmark_timer_initialize(); |
30 | status = pthread_mutex_init( &MutexId, NULL ); |
31 | end_time = benchmark_timer_read(); |
32 | rtems_test_assert( status == 0 ); |
33 | |
34 | put_time( |
35 | "pthread_mutex_init", |
36 | end_time, |
37 | 1, |
38 | 0, |
39 | 0 |
40 | ); |
41 | } |
42 | |
43 | void test_mutex_destroy(void) |
44 | { |
45 | benchmark_timer_t end_time; |
46 | int status; |
47 | |
48 | benchmark_timer_initialize(); |
49 | status = pthread_mutex_destroy( &MutexId ); |
50 | end_time = benchmark_timer_read(); |
51 | rtems_test_assert( status == 0 ); |
52 | |
53 | put_time( |
54 | "pthread_mutex_destroy", |
55 | end_time, |
56 | 1, |
57 | 0, |
58 | 0 |
59 | ); |
60 | } |
61 | |
62 | void *POSIX_Init( |
63 | void *argument |
64 | ) |
65 | { |
66 | |
67 | puts( "\n\n*** POSIX TIME TEST PSXTMMUTEX01 ***" ); |
68 | |
69 | test_mutex_create(); |
70 | test_mutex_destroy(); |
71 | |
72 | puts( "*** END OF POSIX TIME TEST PSXTMMUTEX01 ***" ); |
73 | |
74 | rtems_test_exit(0); |
75 | } |
76 | |
77 | /* configuration information */ |
78 | |
79 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
80 | #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER |
81 | |
82 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
83 | #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 |
84 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
85 | |
86 | #define CONFIGURE_INIT |
87 | |
88 | #include <rtems/confdefs.h> |
89 | /* end of file */ |
Note: See TracBrowser
for help on using the repository browser.