forked from Imagelibrary/rtems
posix: glibc compatibility
This commit is contained in:
@@ -50,9 +50,6 @@ int pthread_setcancelstate(
|
|||||||
if ( _ISR_Is_in_progress() )
|
if ( _ISR_Is_in_progress() )
|
||||||
return EPROTO;
|
return EPROTO;
|
||||||
|
|
||||||
if ( !oldstate )
|
|
||||||
return EINVAL;
|
|
||||||
|
|
||||||
if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
|
if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
@@ -61,7 +58,9 @@ int pthread_setcancelstate(
|
|||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];
|
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
|
if (oldstate != NULL)
|
||||||
*oldstate = thread_support->cancelability_state;
|
*oldstate = thread_support->cancelability_state;
|
||||||
|
|
||||||
thread_support->cancelability_state = state;
|
thread_support->cancelability_state = state;
|
||||||
|
|
||||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
|
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ int pthread_setcanceltype(
|
|||||||
if ( _ISR_Is_in_progress() )
|
if ( _ISR_Is_in_progress() )
|
||||||
return EPROTO;
|
return EPROTO;
|
||||||
|
|
||||||
if ( !oldtype )
|
|
||||||
return EINVAL;
|
|
||||||
|
|
||||||
if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
|
if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
@@ -61,7 +58,9 @@ int pthread_setcanceltype(
|
|||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];
|
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
|
if ( oldtype != NULL )
|
||||||
*oldtype = thread_support->cancelability_type;
|
*oldtype = thread_support->cancelability_type;
|
||||||
|
|
||||||
thread_support->cancelability_type = type;
|
thread_support->cancelability_type = type;
|
||||||
|
|
||||||
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
|
_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
|
||||||
|
|||||||
@@ -95,17 +95,17 @@ void *countTaskAsync(void *ignored)
|
|||||||
TEST_BEGIN();
|
TEST_BEGIN();
|
||||||
|
|
||||||
/* generate some error conditions */
|
/* generate some error conditions */
|
||||||
puts( "Init - pthread_setcancelstate - NULL oldstate - EINVAL" );
|
puts( "Init - pthread_setcancelstate - NULL oldstate" );
|
||||||
sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
|
||||||
fatal_posix_service_status( sc, EINVAL, "cancel state EINVAL" );
|
fatal_posix_service_status( sc, 0, "cancel state NULL" );
|
||||||
|
|
||||||
puts( "Init - pthread_setcancelstate - bad state - EINVAL" );
|
puts( "Init - pthread_setcancelstate - bad state - EINVAL" );
|
||||||
sc = pthread_setcancelstate(12, &old);
|
sc = pthread_setcancelstate(12, &old);
|
||||||
fatal_posix_service_status( sc, EINVAL, "cancel state EINVAL" );
|
fatal_posix_service_status( sc, EINVAL, "cancel state EINVAL" );
|
||||||
|
|
||||||
puts( "Init - pthread_setcanceltype - NULL oldtype - EINVAL" );
|
puts( "Init - pthread_setcanceltype - NULL oldtype" );
|
||||||
sc = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
sc = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
||||||
fatal_posix_service_status( sc, EINVAL, "cancel type EINVAL" );
|
fatal_posix_service_status( sc, 0, "cancel type NULL" );
|
||||||
|
|
||||||
puts( "Init - pthread_setcanceltype - bad type - EINVAL" );
|
puts( "Init - pthread_setcanceltype - bad type - EINVAL" );
|
||||||
sc = pthread_setcanceltype(12, &old);
|
sc = pthread_setcanceltype(12, &old);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
*** POSIX CANCEL TEST ***
|
*** BEGIN OF TEST PSXCANCEL ***
|
||||||
Init - pthread_setcancelstate - NULL oldstate - EINVAL
|
Init - pthread_setcancelstate - NULL oldstate
|
||||||
Init - pthread_setcancelstate - bad state - EINVAL
|
Init - pthread_setcancelstate - bad state - EINVAL
|
||||||
Init - pthread_setcanceltype - NULL oldtype - EINVAL
|
Init - pthread_setcanceltype - NULL oldtype
|
||||||
Init - pthread_setcanceltype - bad type - EINVAL
|
Init - pthread_setcanceltype - bad type - EINVAL
|
||||||
Init - pthread_cancel - bad ID - EINVAL
|
Init - pthread_cancel - bad ID - EINVAL
|
||||||
countTaskDeferred: elapsed time (second): 0
|
countTaskDeferred: elapsed time (second): 0
|
||||||
|
|||||||
Reference in New Issue
Block a user