9
returnステートメントはロックの内部または外部のどちらにあるべきですか?
コードのどこかに、returnステートメントがロックの内側と外側のどこかにあることに気づきました。どれが一番いいですか? 1) void example() { lock (mutex) { //... } return myData; } 2) void example() { lock (mutex) { //... return myData; } } どちらを使用すればよいですか?
142
c#
.net
multithreading
mutex