-
Notifications
You must be signed in to change notification settings - Fork 0
Lazy #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Lazy #74
Conversation
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В целом всё так, но надо больше тестов
| let holder = LazyFactory<obj>.LockMultiThreadLazy(fun () -> obj()) | ||
| let toCompare = holder.Get() | ||
| for i in 1..100500 do | ||
| holder.Get() |> should equal toCompare |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так это ж не многопоточно. Тесты пока нигде не проверяют, что если из нескольких потоков подёргать Lazy, всё хорошо будет. Тем более что самое интересное в многопоточном случае --- это гонки при первом Get, а тут он делается даже до цикла, так что если бы цикл был параллельным, это бы тоже было непоказательно
| open LockMultiThreadLazy | ||
| open LockFreeLazy | ||
|
|
||
| type LazyFactory<'a> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тоже неплохо бы комментарии
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не проверяется, что в случае не-lock-free-многопоточного теста вызов supplier делается ровно один раз, но лучше, чем ничего, да. Зачтена.
No description provided.