source: rtems/testsuites/psxtmtests/psxtmcleanup01/init.c @ 36e1b82

Last change on this file since 36e1b82 was 36e1b82, checked in by Joel Sherrill <joel@…>, on Dec 5, 2018 at 9:23:58 PM

psxtmcleanup01/init.c: Fix warnings

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 2018.
3 *  Himanshu Sekhar Nayak(GCI 2018)
4 *
5 *  Permission to use, copy, modify, and/or distribute this software
6 *  for any purpose with or without fee is hereby granted.
7 *
8 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9 *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
10 *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
11 *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
12 *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
13 *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
14 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <pthread.h>
22#include <timesys.h>
23#include <tmacros.h>
24#include <rtems/btimer.h>
25#include "test_support.h"
26
27const char rtems_test_name[] = "PSXTMCLEANUP01";
28
29/* forward declarations to avoid warnings */
30void *POSIX_Init(void *argument);
31
32int status = 1;
33
34static void routine(void *arg)
35{
36}
37
38static void benchmark_pthread_cleanup_push_pull(void)
39{
40  long end_time;
41  int execute = 1;
42  status = 0;
43
44  benchmark_timer_initialize();
45  pthread_cleanup_push(routine, NULL);
46  end_time = benchmark_timer_read();
47  rtems_test_assert( status == 0 );
48  put_time(
49    "pthread_cleanup_push : only case",
50    end_time,
51    1,        /* Only executed once */
52    0,
53    0
54  );
55
56  benchmark_timer_initialize();
57  pthread_cleanup_pop( execute );
58  end_time = benchmark_timer_read();
59  rtems_test_assert( status == 0 );
60  put_time(
61    "pthread_cleanup_pop : only case",
62    end_time,
63    1,        /* Only executed once */
64    0,
65    0
66  );
67
68}
69
70void *POSIX_Init(
71  void *argument
72)
73{
74
75  TEST_BEGIN();
76
77  benchmark_pthread_cleanup_push_pull();
78
79  TEST_END();
80  rtems_test_exit(0);
81}
82
83/* configuration information */
84
85#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
86#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
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 */
Note: See TracBrowser for help on using the repository browser.