You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like your library and it's very readable and use to fun. One thing I am wondering is if there is any multi-thread issue because your implementation has one instance.
internal val calendar: Calendar by lazy {
Calendar.getInstance(DateHelper.getSydneyTimeZone())
}
From my understanding, lazy it doesn't create more than one instance and when thread1 and thread2 tries to update date, it think there could be a race condition. What do you think?
The text was updated successfully, but these errors were encountered:
@krpot However yes; you are right, since the underlying Calendar instance is shared and is not thread-safe. Perhaps it would be better to use Calendar.getInstance() every time.
I like your library and it's very readable and use to fun. One thing I am wondering is if there is any multi-thread issue because your implementation has one instance.
internal val calendar: Calendar by lazy {
Calendar.getInstance(DateHelper.getSydneyTimeZone())
}
From my understanding, lazy it doesn't create more than one instance and when thread1 and thread2 tries to update date, it think there could be a race condition. What do you think?
The text was updated successfully, but these errors were encountered: