Skip to content

Commit 5c9eb1e

Browse files
authored
Update numpy_random.h
1 parent 909f81d commit 5c9eb1e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/numpy_random.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,10 @@ class RandomState {
266266
std::lock_guard lock{mutex};
267267
_internal_state.uninit();
268268
}
269-
269+
270+
/* This is a very bad implementation, this doesn't garuntee thread safety,
271+
because after returning the reference we can easily mutate it from different threads
272+
this lock simply does nothing. */
270273
RngEngine& get_engine() {
271274
std::lock_guard lock{mutex};
272275
return _engine;
@@ -684,4 +687,4 @@ class NumpySeedSequence {
684687

685688
private:
686689
internal_numpy_seed_sequence _inner{pool_size};
687-
};
690+
};

0 commit comments

Comments
 (0)