Scala: thread-safe circular iterator -
what correct way create thread-safe, infinite circular iterator in scala? seems following not thread safe (iterating simulataneously multiple threads on iterator throws exceptions):
val map = map(1->"one", 2->"two") val iterator = iterator.continually(map).flatten
how correct make thread-safe?
i've ran same question think can safe implementation dependent discussed here.
iterator.synchronized( iterator.next() )
Comments
Post a Comment