OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [psxtests/] [psx10/] [task.c] - Blame information for rev 389

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  Task_1
2
 *
3
 *  This routine serves as a test task.
4
 *
5
 *  Input parameters:
6
 *    argument - task argument
7
 *
8
 *  Output parameters:  NONE
9
 *
10
 *  COPYRIGHT (c) 1989-1999.
11
 *  On-Line Applications Research Corporation (OAR).
12
 *
13
 *  The license and distribution terms for this file may be
14
 *  found in the file LICENSE in this distribution or at
15
 *  http://www.OARcorp.com/rtems/license.html.
16
 *
17
 *  $Id: task.c,v 1.2 2001-09-27 12:02:24 chris Exp $
18
 */
19
 
20
#include "system.h"
21
 
22
void *Task_1(
23
  void *argument
24
)
25
{
26
  int  status;
27
 
28
/* wait for a condition variable signal from Init */
29
 
30
  Task_id = pthread_self();
31
  printf( "Task_1: ID is 0x%08x\n", Task_id );
32
 
33
  status = pthread_mutex_init( &Mutex_id, NULL );
34
  assert( !status );
35
 
36
  status = pthread_mutex_lock( &Mutex_id );
37
  assert( !status );
38
 
39
  puts( "Task_1: pthread_cond_wait" );
40
  status = pthread_cond_wait( &Cond1_id, &Mutex_id );
41
  assert( !status );
42
 
43
  puts( "Task_1: back from pthread_cond_wait release mutex" );
44
  status = pthread_mutex_unlock( &Mutex_id );
45
  assert( !status );
46
 
47
/* wait for a condition variable broadcast from Init */
48
 
49
  status = pthread_mutex_lock( &Mutex_id );
50
  assert( !status );
51
 
52
  puts( "Task_1: pthread_cond_wait" );
53
  status = pthread_cond_wait( &Cond1_id, &Mutex_id );
54
  assert( !status );
55
 
56
  puts( "Task_1: back from pthread_cond_wait release mutex" );
57
  status = pthread_mutex_unlock( &Mutex_id );
58
  assert( !status );
59
 
60
  puts( "Task_1: task exit" );
61
  pthread_exit( NULL );
62
 
63
  return NULL; /* just so the compiler thinks we returned something */
64
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.