source: rtems/testsuites/psxtests/psx15/init.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2010 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <stdio.h>
20#include <inttypes.h>
21
22#include <rtems.h>
23
24#include "tmacros.h"
25
26/*
27 * This test case shows that post switch extension handlers must cope with
28 * already deleted resources (e.g. _POSIX_signals_Post_switch_extension()).
29 * The thread delete extensions run with thread dispatching enabled.  Only the
30 * allocation mutex is locked.
31 */
32
33static rtems_id task_0 = RTEMS_ID_NONE;
34
35static rtems_id task_1 = RTEMS_ID_NONE;
36
37static void thread_delete_hook(
38  Thread_Control *executing,
39  Thread_Control *deleted
40)
41{
42  rtems_status_code sc = RTEMS_SUCCESSFUL;
43
44  if (deleted->Object.id == task_0) {
45    rtems_task_priority old = 0;
46
47    sc = rtems_task_set_priority(task_1, 2, &old);
48    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
49  }
50}
51
52static void suicide_task(rtems_task_argument arg)
53{
54  printf("suicide task %" PRIuPTR "\n", arg);
55
56  rtems_task_delete(RTEMS_SELF);
57  rtems_test_assert(false);
58}
59
60void Init(rtems_task_argument arg)
61{
62  rtems_status_code sc = RTEMS_SUCCESSFUL;
63
64  puts("\n\n*** POSIX TEST 15 ***");
65
66  sc = rtems_task_create(
67    rtems_build_name('T', 'S', 'K', '1'),
68    5,
69    RTEMS_MINIMUM_STACK_SIZE,
70    RTEMS_DEFAULT_MODES,
71    RTEMS_DEFAULT_ATTRIBUTES,
72    &task_1
73  );
74  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
75
76  sc = rtems_task_start(task_1, suicide_task, 1);
77  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
78
79  sc = rtems_task_create(
80    rtems_build_name('T', 'S', 'K', '0'),
81    3,
82    RTEMS_MINIMUM_STACK_SIZE,
83    RTEMS_DEFAULT_MODES,
84    RTEMS_DEFAULT_ATTRIBUTES,
85    &task_0
86  );
87  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
88
89  sc = rtems_task_start(task_0, suicide_task, 0);
90  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
91
92  puts("*** END OF POSIX TEST 15 ***");
93
94  rtems_test_exit(0);
95  rtems_test_assert(false);
96}
97
98#define CONFIGURE_INIT
99
100#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
101#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
102
103#define CONFIGURE_MAXIMUM_TASKS 3
104#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
105
106#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
107
108#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
109#define CONFIGURE_INIT_TASK_PRIORITY 4
110
111#define CONFIGURE_INITIAL_EXTENSIONS { .thread_delete = thread_delete_hook }
112
113#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.