source: rtems/testsuites/psxtmtests/psxtmmutex01/init.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.7 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/timerdrv.h>
16#include <errno.h>
17#include <pthread.h>
18#include "test_support.h"
19
20/* forward declarations to avoid warnings */
21void *POSIX_Init(void *argument);
22
23pthread_mutex_t MutexId;
24
25static void test_mutex_create(void)
26{
27  benchmark_timer_t end_time;
28  int  status;
29
30  benchmark_timer_initialize();
31    status = pthread_mutex_init( &MutexId, NULL );
32  end_time = benchmark_timer_read();
33  rtems_test_assert( status == 0 );
34
35  put_time(
36    "pthread_mutex_init: only case",
37    end_time,
38    1,
39    0,
40    0
41  );
42}
43
44static void test_mutex_destroy(void)
45{
46  benchmark_timer_t end_time;
47  int  status;
48
49  benchmark_timer_initialize();
50    status = pthread_mutex_destroy( &MutexId );
51  end_time = benchmark_timer_read();
52  rtems_test_assert( status == 0 );
53
54  put_time(
55    "pthread_mutex_destroy: only case",
56    end_time,
57    1,
58    0,
59    0
60  );
61}
62
63void *POSIX_Init(
64  void *argument
65)
66{
67
68  puts( "\n\n*** POSIX TIME TEST PSXTMMUTEX01 ***" );
69
70  test_mutex_create();
71  test_mutex_destroy();
72
73  puts( "*** END OF POSIX TIME TEST PSXTMMUTEX01 ***" );
74
75  rtems_test_exit(0);
76}
77
78/* configuration information */
79
80#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
81#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
82
83#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
84#define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
85#define CONFIGURE_POSIX_INIT_THREAD_TABLE
86
87#define CONFIGURE_INIT
88
89#include <rtems/confdefs.h>
90/* end of file */
Note: See TracBrowser for help on using the repository browser.