Can anyone let me know why this code runs forever:
from algorithm.functional import parallelize
from collections.set import Dict
fn main():
var d = Dict[Int, Int]()
@parameter
fn assign(i: Int):
d[i] = i
parallelize[assign](5000)
Dict is not thread safe, and you’re likely encountering all sorts of weird behavior as a result of that UB from threads writing to the structure at the same time. Mojo is still working on a model of concurrency, so for now parallelize is not really a safe construct and the borrow checker can’t help you.