summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-17 14:51:45 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-05-26 13:40:24 +0200
commit29187be532c7d6c7b81f2e7def132bbfba7c916c (patch)
tree472d495928b0095633235c450195b39cb8981256 /cpukit/posix/src
parentscore: Simplify calling _Thread_Exit() (diff)
downloadrtems-29187be532c7d6c7b81f2e7def132bbfba7c916c.tar.bz2
posix: Allow pthread_cancel() from within ISRs
Close #4413.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/cancel.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c
index f2636e6a97..aa4a434037 100644
--- a/cpukit/posix/src/cancel.c
+++ b/cpukit/posix/src/cancel.c
@@ -38,14 +38,6 @@ int pthread_cancel( pthread_t thread )
Thread_Control *executing;
Per_CPU_Control *cpu_self;
- /*
- * Don't even think about deleting a resource from an ISR.
- */
-
- if ( _ISR_Is_in_progress() ) {
- return EPROTO;
- }
-
the_thread = _Thread_Get( thread, &lock_context );
if ( the_thread == NULL ) {
@@ -55,7 +47,10 @@ int pthread_cancel( pthread_t thread )
cpu_self = _Per_CPU_Get();
executing = _Per_CPU_Get_executing( cpu_self );
- if ( the_thread == executing ) {
+ if (
+ the_thread == executing &&
+ !_Per_CPU_Is_ISR_in_progress( cpu_self )
+ ) {
_ISR_lock_ISR_enable( &lock_context );
_Thread_Exit( PTHREAD_CANCELED, THREAD_LIFE_TERMINATING );
} else {