https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94087

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Carlos O'Ryan from comment #0)
> Creating and using a `std::random_device` object fails when used from
> multiple threads.

That's undefined behaviour. Calling non-const member functions on a single
object from multiple threads is always undefined unless specified otherwise.

It might work "by accident", if GCC detects that your CPU supports the RDRAND
instruction and that can be used (because doing so is stateless) but it will
fail if it has to read from the /dev/random or /dev/urandom devices.

Reply via email to