libc/sched: Return EINVAL when type incorrect at task_setcanceltype

https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_setcancelstate.html

The pthread_setcancelstate() function may fail if:

[EINVAL]
The specified state is not PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.
The pthread_setcanceltype() function may fail if:

[EINVAL]
The specified type is not PTHREAD_CANCEL_DEFERRED or PTHREAD_CANCEL_ASYNCHRONOUS.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-05-05 00:59:48 +08:00 committed by Xiang Xiao
parent 962dfaf651
commit f132edbf35
1 changed files with 1 additions and 1 deletions

View File

@ -55,5 +55,5 @@ int task_setcanceltype(int type, FAR int *oldtype)
/* Check the requested cancellation type */
return (type == TASK_CANCEL_ASYNCHRONOUS) ? OK : ENOSYS;
return (type == TASK_CANCEL_ASYNCHRONOUS) ? OK : EINVAL;
}