Crystal: [RFC] Mutex vs SpinLock API

Created on 30 May 2020  路  2Comments  路  Source: crystal-lang/crystal

LetMutex and Crystal::SpinLock use the same API so use we can use them interchangeably especially in benchmarks.

  • Mutex#synchronize -> Mutex#sync.
  • New method Mutex#unsync.
  • Deprecate #synchronize.
question

Most helpful comment

Crystal::SpinLock is internal API. Anything inside the Crystal namespace except VERSION is internal and you shouldn't use it because it might be moved, changed or completely disappear.

All 2 comments

Crystal::SpinLock is internal API. Anything inside the Crystal namespace except VERSION is internal and you shouldn't use it because it might be moved, changed or completely disappear.

  1. Is there a clear benefit to having incompatible API's?
  2. I'm experimenting concurrent safe data structures. Some of these may be included in future PR's and maybe integrated in to crystal so using SpinLock is appropriate. If not accepted they'll stay in concurrent.cr still using internal API's with me maintaining them.
Was this page helpful?
0 / 5 - 0 ratings