Commit f004258
fix(userspace/engine): replace non-thread-safe random() with thread-local RNG
random() uses internal static state that is not thread-safe. Since
should_drop_evt() can be called concurrently from per-source event
processing threads, replace it with a thread_local std::mt19937
seeded by std::random_device. Remove the now-unused srandom() seed
and Windows compat defines.
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>1 parent 6a00de2 commit f004258
1 file changed
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
23 | 21 | | |
24 | | - | |
25 | | - | |
26 | 22 | | |
| 23 | + | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| |||
52 | 49 | | |
53 | 50 | | |
54 | 51 | | |
55 | | - | |
| 52 | + | |
56 | 53 | | |
57 | 54 | | |
58 | 55 | | |
| |||
62 | 59 | | |
63 | 60 | | |
64 | 61 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 62 | | |
70 | 63 | | |
71 | 64 | | |
| |||
1007 | 1000 | | |
1008 | 1001 | | |
1009 | 1002 | | |
1010 | | - | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
1011 | 1006 | | |
1012 | 1007 | | |
0 commit comments