posix: Fix return status of pthread_cancel()

POSIX recommends ESRCH in case no thread exists for the specified
identifier.

Close #2713.
This commit is contained in:
Sebastian Huber
2016-05-13 14:59:31 +02:00
parent df23f464be
commit 9fd72713c9
2 changed files with 3 additions and 3 deletions

View File

@@ -64,5 +64,5 @@ int pthread_cancel(
break; break;
} }
return EINVAL; return ESRCH;
} }

View File

@@ -111,9 +111,9 @@ void *countTaskAsync(void *ignored)
sc = pthread_setcanceltype(12, &old); sc = pthread_setcanceltype(12, &old);
fatal_posix_service_status( sc, EINVAL, "cancel type EINVAL" ); fatal_posix_service_status( sc, EINVAL, "cancel type EINVAL" );
puts( "Init - pthread_cancel - bad ID - EINVAL" ); puts( "Init - pthread_cancel - bad ID - ESRCH" );
sc = pthread_cancel(0x100); sc = pthread_cancel(0x100);
fatal_posix_service_status( sc, EINVAL, "cancel bad Id" ); fatal_posix_service_status( sc, ESRCH, "cancel bad Id" );
/* Start countTask deferred */ /* Start countTask deferred */
{ {