Changeset d9d0a84 in rtems


Ignore:
Timestamp:
Sep 1, 2015, 12:07:51 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
3b3d1489
Parents:
44f3ea9
Message:

psxtests/psxcancel: Check return status

Update #2402.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxcancel/init.c

    r44f3ea9 rd9d0a84  
    4242  int i=0;
    4343  int type,state;
     44  int sc;
    4445
    45   pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
    46   pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &state);
     46  sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
     47  fatal_posix_service_status( sc, 0, "cancel state deferred" );
     48  rtems_test_assert( type == PTHREAD_CANCEL_ENABLE );
     49  sc = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &state);
     50  fatal_posix_service_status( sc, 0, "cancel type deferred" );
     51  rtems_test_assert( state == PTHREAD_CANCEL_DEFERRED );
    4752  while (1) {
    4853    printf("countTaskDeferred: elapsed time (second): %2d\n", i++ );
     
    5661  int i=0;
    5762  int type,state;
     63  int sc;
    5864
    59   pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
    60   pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &state);
     65  sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
     66  fatal_posix_service_status( sc, 0, "cancel state async" );
     67  rtems_test_assert( type == PTHREAD_CANCEL_ENABLE );
     68  sc = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &state);
     69  fatal_posix_service_status( sc, 0, "cancel type async" );
     70  rtems_test_assert( state == PTHREAD_CANCEL_DEFERRED );
    6171  pthread_cleanup_push(countTask_cancel_handler, NULL);
    6272  while (1) {
     
    115125    /* sleep for 5 seconds, then cancel it */
    116126    sleep(5);
    117     pthread_cancel(task);
    118     pthread_join(task, NULL);
     127    sc = pthread_cancel(task);
     128    fatal_posix_service_status( sc, 0, "cancel deferred" );
     129    sc = pthread_join(task, NULL);
     130    fatal_posix_service_status( sc, 0, "join deferred" );
    119131  }
    120132
     
    128140    /* sleep for 5 seconds, then cancel it */
    129141    sleep(5);
    130     pthread_cancel(task);
    131     pthread_join(task, NULL);
     142    sc = pthread_cancel(task);
     143    fatal_posix_service_status( sc, 0, "cancel async" );
     144    sc = pthread_join(task, NULL);
     145    fatal_posix_service_status( sc, 0, "join async" );
    132146  }
    133147
Note: See TracChangeset for help on using the changeset viewer.