D5966: Fix race-condition in KRandom-seeding.

Thomas Friedrichsmeier noreply at phabricator.kde.org
Tue May 30 06:41:27 UTC 2017


tfry added inline comments.

INLINE COMMENTS

> dfaure wrote in krandomtest.cpp:168
> variable size array, which is not in the standard.
> https://stackoverflow.com/questions/1887097/why-arent-variable-length-arrays-part-of-the-c-standard
> 
> Make size static to fix it.

Sorry. Should have waited longer for your comment.

I thought "const int" was const... Will fix in a minute.

> dfaure wrote in krandomtest.cpp:178
> The unittest doesn't check that at all. I guess it can't, reliably, but then what is the comment for?

If the results are not unique, some of the results will already be in the set, and so results.insert() does not increase the size of the set. Only if each thread result is unique, the set size will correspond to the number of threads.

REPOSITORY
  R244 KCoreAddons

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

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


More information about the Kde-frameworks-devel mailing list