D5966: Fix race-condition in KRandom-seeding.

David Faure noreply at phabricator.kde.org
Mon May 29 21:45:13 UTC 2017


dfaure added inline comments.

INLINE COMMENTS

> krandomtest.cpp:168
> +    const int size = 5;
> +    KRandomTestThread* threads[size];
> +    for (int i=0; i < size; ++i) {

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.

> krandomtest.cpp:178
> +    }
> +    // each thread should have returned a unique result
> +    QVERIFY(results.size() == size);

The unittest doesn't check that at all. I guess it can't, reliably, but then what is the comment for?

> krandomtest.cpp:179
> +    // each thread should have returned a unique result
> +    QVERIFY(results.size() == size);
> +    for (int i=0; i < size; ++i) {

QCOMPARE

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/20170529/7c8e39a9/attachment.html>


More information about the Kde-frameworks-devel mailing list