source: rtems/testsuites/psxtests/psx05/task.c @ 33c46f1

4.115
Last change on this file since 33c46f1 was 33c46f1, checked in by Joel Sherrill <joel.sherrill@…>, on 10/21/10 at 21:22:25

2010-10-21 Joel Sherrill <joel.sherrill@…>

  • psx02/init.c, psx02/task.c, psx03/init.c, psx04/init.c, psx04/task1.c, psx04/task2.c, psx04/task3.c, psx05/init.c, psx05/task.c, psx05/task2.c, psx05/task3.c, psx06/init.c, psx06/task.c, psx06/task2.c, psx07/init.c, psx08/init.c, psx08/task2.c, psx08/task3.c, psx09/init.c, psx10/init.c, psx10/task.c, psx10/task2.c, psx10/task3.c, psx11/init.c, psx11/task.c, psx12/init.c, psxalarm01/init.c, psxbarrier01/test.c, psxcancel01/init.c, psxchroot01/test.c, psxitimer/init.c, psxkey01/task.c, psxkey02/init.c, psxkey03/init.c, psxmount/test.c, psxmsgq01/init.c, psxmsgq03/init.c, psxmsgq04/init.c, psxrwlock01/test.c, psxsem01/init.c, psxsignal01/init.c, psxsignal01/task1.c, psxsignal02/init.c, psxsignal03/init.c, psxsignal05/init.c, psxspin01/test.c, psxspin02/test.c, psxstack01/init.c, psxstack02/init.c, psxualarm/init.c: Eliminate double space after parenthesis on rtems_test_assert().
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*  Task_1
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.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22#include <errno.h>
23
24void *Task_1(
25  void *argument
26)
27{
28  int status;
29
30  printf( "Task: pthread_mutex_trylock already locked\n" );
31  status = pthread_mutex_trylock( &Mutex_id );
32  if ( status != EBUSY )
33    printf( "status = %d\n", status );
34  rtems_test_assert( status == EBUSY );
35
36  printf( "Task: pthread_mutex_lock unavailable\n" );
37  status = pthread_mutex_lock( &Mutex_id );
38  if ( status )
39    printf( "status = %d\n", status );
40  rtems_test_assert( !status );
41
42     /* switch to init */
43
44  printf( "Task: mutex acquired\n" );
45
46  printf( "Task: sleep for 2 seconds\n" );
47  sleep( 2 );
48
49     /* switch to init */
50
51  printf( "Task: exit\n" );
52  pthread_exit( NULL );
53
54     /* switch to Init */
55
56  return NULL; /* just so the compiler thinks we returned something */
57}
Note: See TracBrowser for help on using the repository browser.