summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxspin01/psxspin01.scn
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-16 14:50:09 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-23 12:52:06 +0100
commitc42be504c92d76d2e06d0fc8ebd05fc913376d2d (patch)
tree259f8a712a6139f427888647955bc3c95480877e /testsuites/psxtests/psxspin01/psxspin01.scn
parentscore: Add RTEMS_ALIAS() (diff)
downloadrtems-c42be504c92d76d2e06d0fc8ebd05fc913376d2d.tar.bz2
posix: Add self-contained pthread spinlock
Turn pthread_spinlock_t into a self-contained object. On uni-processor configurations, interrupts are disabled in the lock/trylock operations and the previous interrupt status is restored in the corresponding unlock operations. On SMP configurations, a ticket lock is a acquired and released in addition. The self-contained pthread_spinlock_t object is defined by Newlib in <sys/_pthreadtypes.h>. typedef struct { struct _Ticket_lock_Control _lock; __uint32_t _interrupt_state; } pthread_spinlock_t; This implementation is simple and efficient. However, this test case of the Linux Test Project would fail due to call of printf() and sleep() during spin lock ownership: https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c There is only limited support for profiling on SMP configurations. Delete CORE spinlock implementation. Update #2674.
Diffstat (limited to 'testsuites/psxtests/psxspin01/psxspin01.scn')
-rw-r--r--testsuites/psxtests/psxspin01/psxspin01.scn46
1 files changed, 16 insertions, 30 deletions
diff --git a/testsuites/psxtests/psxspin01/psxspin01.scn b/testsuites/psxtests/psxspin01/psxspin01.scn
index 5c0e752969..dae970f1a0 100644
--- a/testsuites/psxtests/psxspin01/psxspin01.scn
+++ b/testsuites/psxtests/psxspin01/psxspin01.scn
@@ -1,32 +1,18 @@
*** BEGIN OF TEST PSXSPIN 1 ***
-pthread_spin_init( NULL, PTHREAD_PROCESS_PRIVATE ) -- EINVAL
-pthread_spin_init( NULL, PTHREAD_PROCESS_SHARED ) -- EINVAL
-pthread_spin_init( &spinlock, 0x1234 ) -- EINVAL
-pthread_spin_init( &spinlock, PTHREAD_PROCESS_SHARED ) -- EINVAL
-pthread_spin_init( &Spinlock, PTHREAD_PROCESS_PRIVATE ) -- OK
-pthread_spin_init( &spinlock, PTHREAD_PROCESS_PRIVATE ) -- EAGAIN
-pthread_spin_init( &spinlock, PTHREAD_PROCESS_PRIVATE ) -- EAGAIN
-pthread_spin_lock( NULL ) -- EINVAL
-pthread_spin_trylock( NULL ) -- EINVAL
-pthread_spin_unlock( NULL ) -- EINVAL
-pthread_spin_destroy( NULL ) -- EINVAL
-pthread_spin_lock( &spinlock ) -- EINVAL
-pthread_spin_trylock( &spinlock ) -- EINVAL
-pthread_spin_unlock( &spinlock ) -- EINVAL
-pthread_spin_destroy( &spinlock ) -- EINVAL
-pthread_spin_unlock( &Spinlock ) -- EPERM
-pthread_spin_lock( &Spinlock ) -- OK
-pthread_spin_lock( &Spinlock ) -- EDEADLK
-pthread_spin_trylock( &Spinlock ) -- EDEADLK
-pthread_spin_unlock( &Spinlock ) -- OK
-pthread_spin_trylock( &Spinlock ) -- OK
-pthread_spin_unlock( &Spinlock ) -- OK
-pthread_spin_lock( &Spinlock ) from Thread -- OK
-sleep to allow main thread to run
-pthread_spin_unlock( &Spinlock ) -- EPERM
-pthread_spin_lock( &Spinlock ) -- OK
-pthread_spin_unlock( &Spinlock ) from Thread -- OK
-pthread_spin_destroy( &Spinlock ) -- EBUSY
-pthread_spin_unlock( &Spinlock ) -- OK
-pthread_spin_destroy( &Spinlock ) -- OK
+pthread_spin_init( &spinlock, PTHREAD_PROCESS_PRIVATE ) -- OK
+pthread_spin_destroy( &spinlock ) -- OK
+pthread_spin_init( &spinlock, PTHREAD_PROCESS_SHARED ) -- OK
+pthread_spin_destroy( &spinlock ) -- OK
+pthread_spin_init( &spinlock, 0x1234 ) -- OK
+pthread_spin_init( &spinlock2, 0 ) -- OK
+pthread_spin_lock( &spinlock ) -- OK
+pthread_spin_lock( &spinlock2 ) -- OK
+pthread_spin_unlock( &spinlock2 ) -- OK
+pthread_spin_unlock( &spinlock ) -- OK
+pthread_spin_trylock( &spinlock ) -- OK
+pthread_spin_trylock( &spinlock2 ) -- OK
+pthread_spin_unlock( &spinlock2 ) -- OK
+pthread_spin_unlock( &spinlock ) -- OK
+pthread_spin_destroy( &spinlock2 ) -- OK
+pthread_spin_destroy( &spinlock ) -- OK
*** END OF TEST PSXSPIN 1 ***