source: rtems/testsuites/psxtests/psx08/task2.c @ 7d96321

4.104.114.84.9
Last change on this file since 7d96321 was 7d96321, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 4, 1999 at 7:41:34 PM

Modifications necessary to support testing of exitting a pthread from
Charles-Antione Gauthier <charles.gauthier@…>.

  • 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-1998.
12 *  On-Line Applications Research Corporation (OAR).
13 *  Copyright assigned to U.S. Government, 1994.
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.OARcorp.com/rtems/license.html.
18 *
19 *  $Id$
20 */
21
22#include "system.h"
23#include <errno.h>
24
25void *Task_2(
26  void *argument
27)
28{
29  int   status;
30
31  puts( "Task_2: sleep 1 second" );
32
33  sleep( 1 );
34
35  /* switch to task 3 */
36
37  puts( "Task_2: join to detached task (Init) -- EINVAL" );
38  status = pthread_join( Init_id, NULL );
39  if ( status != EINVAL )
40    printf( "status = %d\n", status );
41  assert( status == EINVAL );
42 
43  puts( "Task_2: join to self task (Init) -- EDEADLK" );
44  status = pthread_join( pthread_self(), NULL );
45  if ( status != EDEADLK )
46    printf( "status = %d\n", status );
47  assert( status == EDEADLK );
48
49  puts( "Task_2: exitting" );
50
51  pthread_exit( &Task2_id );
52
53     /* switch to init task */
54
55  return NULL; /* just so the compiler thinks we returned something */
56}
Note: See TracBrowser for help on using the repository browser.