#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          |   Keywords:
Blocked By:                  |   Blocking:
 RTEMS threads getting locked up when using certain c++ functionality.
 Issue happens for example when std::future is combined with std::async.

 Investigating deeper, seems like this happens if std::async executes
 before std::future gets scheduled to run. Both of these create a
 pthread_once instance.

 _once() uses a common semaphore for all calls, thus the first function
 (async.get usually) gets the lock, calls its “init” function (which blocks
 until the second function has completed. After this, std::future also uses
 pthread_once to execute, but because the lock is already taken, it also
 blocks, casing a deadlock.

 Attached you can find a test application that reproduces the deadlock.

Ticket URL: <http://devel.rtems.org/ticket/3334>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
bugs mailing list

Reply via email to