Closed gabhijit closed 6 months ago
@csking101 : Do you want to take up this?
Yup, I'll look into it.
Hi sir, after looking into OnceCell
, I came across a few things that I wanted to discuss.
OnceCell
is not thread-safe, instead, the proposed alternative is OnceLock
that is a "thread-safe OnceCell". So, should I look into using OnceLock
instead of OnceCell
(since in std
the implementation is as such)?LazyCell
, that initializes values on first access, however it is a part of the nightly build, should I explore that option as well?Yes, OnceCell
is not thread safe, instead you can look into OnceLock
. The semantics are a bit different. Let's try to review the approach first by making one or two small changes and then let's see what makes sense.
Yes LazyCell
will be available only on nightly and that will be kind of limiting, in that case we can continue to work with lazy_cell
as it is.
So let's try and work with OnceLock
first and then determine whether to take that approach further.
Makes Sense?
Fixed by #52
Functionality provided by
lazy_static
is now available as a part ofcore
andstd
asOnceCell
. This can be used in places where we are usinglazy_static
.