Using TDD to drive out thread-safe code

前端 未结 6 1632
清酒与你
清酒与你 2020-12-13 22:26

What\'s a good way to leverage TDD to drive out thread-safe code? For example, say I have a factory method that utilizes lazy initialization to create only one instance of

6条回答
  •  粉色の甜心
    2020-12-13 23:27

    When I test drove an implementation that needed to be thread safe recently I came up with the solution I provided as an answer for this question. Hope that helps even though there are no tests there. Hope link is OK raher than duplicating teh answer...

提交回复
热议问题