D5966: Fix race-condition in KRandom-seeding.

Michael Pyne noreply at phabricator.kde.org
Fri May 26 01:15:25 UTC 2017


mpyne added a comment.


  Would it be better to use `QThreadStorage<bool>` (to record if the thread has been seeded) instead of a `QSet`?  It would allow us to more easily adopt C++11's `thread_local` once we remove support for older compilers.  I also looked into whether we could adopt the higher-quality RNGs that should be available in C++11, but getting them seeded is apparently very difficult to do without introducing errors.
  
  Also, I'd recommend using `quintptr` instead of `intptr_t` in the reinterpret_cast, as that seems more accurate for the semantics of XOR.  The shift to XOR is a great idea though.

REPOSITORY
  R244 KCoreAddons

REVISION DETAIL
  https://phabricator.kde.org/D5966

To: tfry, dfaure
Cc: mpyne, tfry, rjvbb, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170526/380b2156/attachment.html>


More information about the Kde-frameworks-devel mailing list