Notice: We have migrated to GitLab launching 2024-05-01 see here:

#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 11/23/16 at 11:55:03 by Sebastian Huber <sebastian.huber@…>

In [changeset:"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 11/23/16 at 14:12:55 by Sebastian Huber <sebastian.huber@…>

In [changeset:"d42cf3388e6fdc2a82a4fcbeb704c8277cd611a5/rtems"]:

posix: Fix typo

Update #2674.

comment:3 Changed on 12/02/16 at 08:57:24 by Sebastian Huber <sebastian.huber@…>

In [changeset:"aadd318cd92e42839cf86260e1085f2953113180/rtems"]:

posix: Fix fall back spinlock implementation

Update #2674.

comment:4 Changed on 02/15/17 at 13:30:19 by Sebastian Huber

Owner: set to Sebastian Huber
Status: newassigned

comment:5 Changed on 05/11/17 at 07:31:02 by Sebastian Huber


comment:6 Changed on 05/11/17 at 07:41:37 by Sebastian Huber

Resolution: fixed
Status: assignedclosed
Version: 4.10

comment:7 Changed on 10/12/17 at 05:16:16 by Sebastian Huber <sebastian.huber@…>

In [changeset:"9c0cefbfa5eb426ff26954066b5d1f786754a538/rtems" 9c0cefb/rtems]:

confdefs: Add warnings for obsolete options

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

comment:8 Changed on 10/16/17 at 06:17:09 by Sebastian Huber

Component: scoreposix

comment:9 Changed on 10/18/17 at 06:53:08 by Sebastian Huber <sebastian.huber@…>

In [changeset:"6087f33e3145a0164bb0f0b3f375802d14169d4c/rtems" 6087f33e/rtems]:

tmtests/tmfine01: Add test cases

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

comment:10 Changed on 11/09/17 at 06:27:14 by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.