mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 22:48:23 +00:00
Made examples include checking of return status.
This commit is contained in:
@@ -29,14 +29,30 @@ rtems_task init_task(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
@{
|
||||
rtems_id tid;
|
||||
rtems_id tid;
|
||||
rtems_status_code status;
|
||||
rtems_name name;
|
||||
|
||||
/* example assumes SUCCESSFUL return value */
|
||||
name = rtems_build_name( 'A', 'P', 'P', '1' )
|
||||
|
||||
(void) rtems_task_create( USER_APP_NAME, 1, RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid );
|
||||
(void) rtems_task_start( tid, user_application, 0 );
|
||||
(void) rtems_task_delete( SELF );
|
||||
status = rtems_task_create(
|
||||
name, 1, RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid
|
||||
);
|
||||
if ( status != RTEMS_STATUS_SUCCESSFUL ) {
|
||||
printf( "rtems_task_create failed with status of %d.\n", status );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
status = rtems_task_start( tid, user_application, 0 );
|
||||
if ( status != RTEMS_STATUS_SUCCESSFUL ) {
|
||||
printf( "rtems_task_start failed with status of %d.\n", status );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
status = rtems_task_delete( SELF ); /* should not return */
|
||||
printf( "rtems_task_delete returned with status of %d.\n", status );
|
||||
exit( 1 );
|
||||
@}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user