Skip to content
Permalink
Browse files

posix: glibc compatibility

  • Loading branch information...
sebhub committed Sep 1, 2015
1 parent d9d0a84 commit 3b3d1489e409d451b4e7ffabd706d0205f400def
@@ -50,9 +50,6 @@ int pthread_setcancelstate(
if ( _ISR_Is_in_progress() )
return EPROTO;

if ( !oldstate )
return EINVAL;

if ( state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE )
return EINVAL;

@@ -61,7 +58,9 @@ int pthread_setcancelstate(
executing = _Thread_Executing;
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];

*oldstate = thread_support->cancelability_state;
if (oldstate != NULL)
*oldstate = thread_support->cancelability_state;

thread_support->cancelability_state = state;

_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
@@ -50,9 +50,6 @@ int pthread_setcanceltype(
if ( _ISR_Is_in_progress() )
return EPROTO;

if ( !oldtype )
return EINVAL;

if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS )
return EINVAL;

@@ -61,7 +58,9 @@ int pthread_setcanceltype(
executing = _Thread_Executing;
thread_support = executing ->API_Extensions[ THREAD_API_POSIX ];

*oldtype = thread_support->cancelability_type;
if ( oldtype != NULL )
*oldtype = thread_support->cancelability_type;

thread_support->cancelability_type = type;

_POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing );
@@ -95,17 +95,17 @@ void *countTaskAsync(void *ignored)
TEST_BEGIN();

/* generate some error conditions */
puts( "Init - pthread_setcancelstate - NULL oldstate - EINVAL" );
puts( "Init - pthread_setcancelstate - NULL oldstate" );
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" );
sc = pthread_setcancelstate(12, &old);
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);
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" );
sc = pthread_setcanceltype(12, &old);
@@ -1,7 +1,7 @@
*** POSIX CANCEL TEST ***
Init - pthread_setcancelstate - NULL oldstate - EINVAL
*** BEGIN OF TEST PSXCANCEL ***
Init - pthread_setcancelstate - NULL oldstate
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_cancel - bad ID - EINVAL
countTaskDeferred: elapsed time (second): 0

0 comments on commit 3b3d148

Please sign in to comment.
You can’t perform that action at this time.