[RTEMS Project] #3334: deadlock in _once()

RTEMS trac trac at rtems.org
Tue Mar 13 13:34:02 UTC 2018


#3334: deadlock in _once()
----------------------------+---------------------
 Reporter:  Stavros Passas  |       Owner:  (none)
     Type:  defect          |      Status:  new
 Priority:  normal          |   Milestone:  4.11.4
Component:  posix           |     Version:  4.11
 Severity:  normal          |  Resolution:
 Keywords:                  |  Blocked By:
 Blocking:                  |
----------------------------+---------------------

Comment (by Stavros Passas):

 I agree with Sebastian, that using one dedicated mutex for each
 pthread_once_t instance would be a longer term and elegant solution, but
 it would also add overhead for each pthread_t instance.

 I am adding a different proposed solution, which doesn't require newlib
 changes (and increasing the pthread_t size):

 The _once implementation uses a single mutex. Currently this mutex
 protects the whole function, while I believe we need to protect
 reads/writes to the once_state variable only. Concurrent tasks finding the
 state on RUNNING, could just yield until the state becomes
 ONCE_STATE_COMPLETE.

--
Ticket URL: <http://devel.rtems.org/ticket/3334#comment:2>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list