#2674 closed defect (fixed)

CORE spinlock implementation is next to be useless

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: posix Version:
Severity: normal Keywords:
Cc: Blocked By:


Lets assume we have two tasks A and B. Task A acquires a CORE spinlock. Now B somehow executes and tries to acquire the same CORE spinlock, then no progress can be made.

Alternative implementation:

Disable thread dispatching and interrupts while owning the spinlock. Forbid blocking calls while owning the spinlock.

Drawback: The test cases of the Linux Test Project would fail:


Optimization: User provided storage space for pthread_spin_t. In line with POSIX:

"Only the object referenced by lock may be used for performing synchronization."


Change History (10)

comment:1 Changed on Nov 23, 2016 at 11:55:03 AM by Sebastian Huber <sebastian.huber@…>

In c42be504c92d76d2e06d0fc8ebd05fc913376d2d/rtems:

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

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:


There is only limited support for profiling on SMP configurations.

Delete CORE spinlock implementation.

Update #2674.

comment:2 Changed on Nov 23, 2016 at 2:12:55 PM by Sebastian Huber <sebastian.huber@…>

comment:3 Changed on Dec 2, 2016 at 8:57:24 AM by Sebastian Huber <sebastian.huber@…>

In aadd318cd92e42839cf86260e1085f2953113180/rtems:

posix: Fix fall back spinlock implementation

Update #2674.

comment:4 Changed on Feb 15, 2017 at 1:30:19 PM by Sebastian Huber

Owner: set to Sebastian Huber
Status: newassigned

comment:5 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber


comment:6 Changed on May 11, 2017 at 7:41:37 AM by Sebastian Huber

Resolution: fixed
Status: assignedclosed
Version: 4.10

comment:7 Changed on Oct 12, 2017 at 5:16:16 AM by Sebastian Huber <sebastian.huber@…>

In 9c0cefb/rtems:

confdefs: Add warnings for obsolete options

Update #2674.
Close #3112.
Close #3113.
Close #3114.
Close #3115.
Close #3116.

comment:8 Changed on Oct 16, 2017 at 6:17:09 AM by Sebastian Huber

Component: scoreposix

comment:9 Changed on Oct 18, 2017 at 6:53:08 AM by Sebastian Huber <sebastian.huber@…>

In 6087f33e/rtems:

tmtests/tmfine01: Add test cases

Update #2674.
Update #3112.
Update #3113.
Update #3114.
Update #3115.

comment:10 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.