potential deadlock in _once

Passas, Stavros stavros.passas at intel.com
Sun Mar 4 21:09:49 UTC 2018


We have faced 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, while std::future also uses pthread_once to create a new thread, but because the lock is already taken, it blocks, casing a deadlock between these two functions.

Is this a known issue?
If not, should I create a ticket about it?

Best Regards,
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263

This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180304/1495a496/attachment.html>

More information about the devel mailing list