source: rtems/testsuites/psxtests/psx08/task2.c @ 9a4eca5

5
Last change on this file since 9a4eca5 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.2 KB
Line 
1/*  Task_2
2 *
3 *  This routine serves as a test task.  It verifies the basic task
4 *  switching capabilities of the executive.
5 *
6 *  Input parameters:
7 *    argument - task argument
8 *
9 *  Output parameters:  NONE
10 *
11 *  COPYRIGHT (c) 1989-2009.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include "system.h"
24#include <errno.h>
25
26void *Task_2(
27  void *argument
28)
29{
30  int   status;
31
32  puts( "Task_2: sleep 1 second" );
33
34  sleep( 1 );
35
36  /* switch to task 3 */
37
38  puts( "Task_2: join to detached task (Init) -- EINVAL" );
39  status = pthread_join( Init_id, NULL );
40  if ( status != EINVAL )
41    printf( "status = %d\n", status );
42  rtems_test_assert( status == EINVAL );
43
44  puts( "Task_2: join to self task (Init) -- EDEADLK" );
45  status = pthread_join( pthread_self(), NULL );
46  if ( status != EDEADLK )
47    printf( "status = %d\n", status );
48  rtems_test_assert( status == EDEADLK );
49
50  puts( "Task_2: exitting" );
51
52  pthread_exit( &Task2_id );
53
54     /* switch to init task */
55
56  return NULL; /* just so the compiler thinks we returned something */
57}
Note: See TracBrowser for help on using the repository browser.