How to make a code thread safe in scala?

后端 未结 4 786
[愿得一人]
[愿得一人] 2021-01-14 02:17

I have a code in scala that, for various reasons, have few lines of code that cannot be accessed by more threads at the same time.

How to easily make it thread-safe?

4条回答
  •  一向
    一向 (楼主)
    2021-01-14 02:45

    In general try to use pure 'functions' or methods with immutable data structures that should help with thread safety.

提交回复
热议问题