Comment

Comment by Blackthorn

Neat idea. Though I think having to pass a lambda for anything you want to do with the fields is awful ergonomics.

Maybe instead combine the two ideas. MutexProtected<T> but can be locked with MutexProtected<T>::lock() which returns a MutexLocked<T> object. That object then cleans up the lock when it goes out of scope, and also provides direct access to the enclosed type.

parent Blackthorn 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton