{"action":"created","issue":{"url":"https://api.github.com/repos/AliSoftware/Dip/issues/31","labels_url":"https://api.github.com/repos/AliSoftware/Dip/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/AliSoftware/Dip/issues/31/comments","events_url":"https://api.github.com/repos/AliSoftware/Dip/issues/31/events","html_url":"https://github.com/AliSoftware/Dip/pull/31","id":123099256,"number":31,"title":"Add thread safety","user":{"login":"mwoollard","id":150681,"avatar_url":"https://avatars.githubusercontent.com/u/150681?v=3","gravatar_id":"","url":"https://api.github.com/users/mwoollard","html_url":"https://github.com/mwoollard","followers_url":"https://api.github.com/users/mwoollard/followers","following_url":"https://api.github.com/users/mwoollard/following{/other_user}","gists_url":"https://api.github.com/users/mwoollard/gists{/gist_id}","starred_url":"https://api.github.com/users/mwoollard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwoollard/subscriptions","organizations_url":"https://api.github.com/users/mwoollard/orgs","repos_url":"https://api.github.com/users/mwoollard/repos","events_url":"https://api.github.com/users/mwoollard/events{/privacy}","received_events_url":"https://api.github.com/users/mwoollard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-19T17:31:26Z","updated_at":"2015-12-20T00:06:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/AliSoftware/Dip/pulls/31","html_url":"https://github.com/AliSoftware/Dip/pull/31","diff_url":"https://github.com/AliSoftware/Dip/pull/31.diff","patch_url":"https://github.com/AliSoftware/Dip/pull/31.patch"},"body":"Add locking around resolution and dictionary modification to ensure thread safety\r\n\r\nMy understanding is Dip isn't currently thread safe when resolving, with risk of two instances of singleton being returned if same type requested at same time from different threads. How about this change to address this? I'd ideally want any container I used to be thread safe :-)\r\n\r\nLet me know what you think !\r\n\r\nKind regards\r\nMark"},"comment":{"url":"https://api.github.com/repos/AliSoftware/Dip/issues/comments/166034857","html_url":"https://github.com/AliSoftware/Dip/pull/31#issuecomment-166034857","issue_url":"https://api.github.com/repos/AliSoftware/Dip/issues/31","id":166034857,"user":{"login":"ilyapuchka","id":1488293,"avatar_url":"https://avatars.githubusercontent.com/u/1488293?v=3","gravatar_id":"","url":"https://api.github.com/users/ilyapuchka","html_url":"https://github.com/ilyapuchka","followers_url":"https://api.github.com/users/ilyapuchka/followers","following_url":"https://api.github.com/users/ilyapuchka/following{/other_user}","gists_url":"https://api.github.com/users/ilyapuchka/gists{/gist_id}","starred_url":"https://api.github.com/users/ilyapuchka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilyapuchka/subscriptions","organizations_url":"https://api.github.com/users/ilyapuchka/orgs","repos_url":"https://api.github.com/users/ilyapuchka/repos","events_url":"https://api.github.com/users/ilyapuchka/events{/privacy}","received_events_url":"https://api.github.com/users/ilyapuchka/received_events","type":"User","site_admin":false},"created_at":"2015-12-20T00:06:09Z","updated_at":"2015-12-20T00:06:09Z","body":"I think this thread safety parameter is an overkill. Dependency resolution is not intended to be used to resolve so many instances that it can drastically decrease performance compared to not using locks and that users would like to turn it off. For me it just makes api and implementation (optional lock) weird. \r\nAlso I would not include benchmark tests for in Dip tests. They are good for reference, but I believe are not needed every time.\r\nI also have some other minor comments regarding code and testing circular dependencies, commented it in code.\r\nApart from that looks fine, thanks for pull request, @mwoollard !"}}