diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-11 12:53:52 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-11 13:22:12 +0200 |
commit | d61fbeda590936ee03e91cf4b200f24d613e6ec2 (patch) | |
tree | 4f889be01b138f1c41d6bc90d2cd4885c06347be /testsuites/psxtests/psx05 | |
parent | libdl/rtl-mdreloc-h8300.c: Remove remnant of h8300 port (diff) | |
download | rtems-d61fbeda590936ee03e91cf4b200f24d613e6ec2.tar.bz2 |
score: _Thread_queue_Surrender_priority_ceiling()
Do not use a direct thread dispatch in
_Thread_queue_Surrender_priority_ceiling() since it may be used in condition
variables using POSIX mutexes.
Close #4526.
Diffstat (limited to '')
-rw-r--r-- | testsuites/psxtests/psx05/init.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c index 2459166321..4c1603daf3 100644 --- a/testsuites/psxtests/psx05/init.c +++ b/testsuites/psxtests/psx05/init.c @@ -406,6 +406,48 @@ static void test_mutex_auto_initialization( void ) } } +static void test_mutex_prio_protect_with_cv( void ) +{ + pthread_mutex_t mutex; + pthread_mutexattr_t attr; + pthread_cond_t cond; + int eno; + struct timespec timeout; + + eno = pthread_mutexattr_init( &attr ); + rtems_test_assert( eno == 0 ); + + eno = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT ); + rtems_test_assert( eno == 0 ); + + eno = pthread_mutex_init( &mutex, &attr ); + rtems_test_assert( eno == 0 ); + + eno = pthread_mutexattr_destroy( &attr ); + rtems_test_assert( eno == 0 ); + + eno = pthread_cond_init( &cond, NULL ); + rtems_test_assert( eno == 0 ); + + eno = pthread_mutex_lock( &mutex ); + rtems_test_assert( eno == 0 ); + + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + + eno = pthread_cond_timedwait( &cond, &mutex, &timeout ); + rtems_test_assert( eno == ETIMEDOUT ); + + eno = pthread_mutex_unlock( &mutex ); + rtems_test_assert( eno == 0 ); + + eno = pthread_mutex_destroy( &mutex ); + rtems_test_assert( eno == 0 ); + + eno = pthread_cond_destroy( &cond ); + rtems_test_assert( eno == 0 ); +} + void *POSIX_Init( void *argument ) @@ -431,6 +473,7 @@ void *POSIX_Init( test_mutex_not_initialized(); test_mutex_invalid_copy(); test_mutex_auto_initialization(); + test_mutex_prio_protect_with_cv(); test_get_priority(); test_set_priority(); test_errors_pthread_setschedprio(); |