diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-19 06:28:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-21 07:29:39 +0200 |
commit | 48b04fc388a60fc6621233ddbb7cd65d89bb63d8 (patch) | |
tree | ebbb0661161ebe5b809fcde7627e1887811d1fc7 /testsuites/psxtests/psx09 | |
parent | score: Add and use _CORE_mutex_Acquire_critical() (diff) | |
download | rtems-48b04fc388a60fc6621233ddbb7cd65d89bb63d8.tar.bz2 |
posix: Avoid Giant lock for mutexes
Delete _POSIX_Mutex_Get(). Use _POSIX_Mutex_Get_interrupt_disable()
instead.
Update #2555.
Diffstat (limited to 'testsuites/psxtests/psx09')
-rw-r--r-- | testsuites/psxtests/psx09/init.c | 46 | ||||
-rw-r--r-- | testsuites/psxtests/psx09/psx09.doc | 1 | ||||
-rw-r--r-- | testsuites/psxtests/psx09/system.h | 2 |
3 files changed, 48 insertions, 1 deletions
diff --git a/testsuites/psxtests/psx09/init.c b/testsuites/psxtests/psx09/init.c index 15c1e4841b..64bb4af252 100644 --- a/testsuites/psxtests/psx09/init.c +++ b/testsuites/psxtests/psx09/init.c @@ -49,6 +49,50 @@ void print_schedparam( #endif } +static void *mutex_lock_task(void *arg) +{ + pthread_mutex_t *mtx; + int eno; + + mtx = arg; + + eno = pthread_mutex_lock( mtx ); + rtems_test_assert( eno == 0 ); + + sched_yield(); + + eno = pthread_mutex_unlock( mtx ); + rtems_test_assert( eno == 0 ); + + return NULL; +} + +static void test_destroy_locked_mutex(void) +{ + pthread_mutex_t mtx; + pthread_t th; + int eno; + + eno = pthread_mutex_init( &mtx, NULL ); + rtems_test_assert( eno == 0 ); + + eno = pthread_create( &th, NULL, mutex_lock_task, &mtx ); + rtems_test_assert( eno == 0 ); + + sched_yield(); + + eno = pthread_mutex_destroy( &mtx ); + rtems_test_assert( eno == EBUSY ); + + sched_yield(); + + eno = pthread_mutex_destroy( &mtx ); + rtems_test_assert( eno == 0 ); + + eno = pthread_join( th, NULL ); + rtems_test_assert( eno == 0 ); +} + void *POSIX_Init( void *argument ) @@ -65,6 +109,8 @@ void *POSIX_Init( TEST_BEGIN(); + test_destroy_locked_mutex(); + /* set the time of day, and print our buffer in multiple ways */ set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 ); diff --git a/testsuites/psxtests/psx09/psx09.doc b/testsuites/psxtests/psx09/psx09.doc index ed5f83bc9b..b90367b669 100644 --- a/testsuites/psxtests/psx09/psx09.doc +++ b/testsuites/psxtests/psx09/psx09.doc @@ -23,3 +23,4 @@ concepts: + thread priority no longer gets adjusted after obtaining mutex
+ thread priority gets locked at the ceiling level
+ unlocks mutex and thread priority is set to low priority successfully
++ lock returns proper status if deleted during lock operation
diff --git a/testsuites/psxtests/psx09/system.h b/testsuites/psxtests/psx09/system.h index 1c71e7fd3a..a5aabeb82d 100644 --- a/testsuites/psxtests/psx09/system.h +++ b/testsuites/psxtests/psx09/system.h @@ -34,7 +34,7 @@ void *Task_2( #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION -#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_MAXIMUM_POSIX_THREADS 2 #define CONFIGURE_MAXIMUM_POSIX_KEYS 10 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10 |