-
Notifications
You must be signed in to change notification settings - Fork 222
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
Mappable lock guards #10
Comments
Unfortunately, the safety hole with It might be possible to implement this using a separate |
That's too bad, but I suppose a I have this scenario where I want quite fast access to data that I want to transform before returning it, to avoid excessive dynamic checks. It would be nice to have a lock that is as light as possible, and part of the reason is that my data structure will usually have to be double locked (once for the whole structure and then for occasional inner mutability of each containing item). The other part of it is just pure speed. I don't think there's a way around that, since the inner mutability is basically a feature, and the function that uses it takes Anyway, this is just me wishing I could just pick features from different libraries 😄 Edit: Made some of my intentions more clear. |
Well it does sound like a nice feature to have, so I'll look into implementing it in parking_lot at some point. |
That would be great 👍 My my actual usecase isn't really the best motivation, since my runtime check may actually be unnoticeably cheap (and hopefully optimized to oblivion), but it's also about convenience, since it's just the beginning of the pipeline. Users may want to keep on mapping. I'll see what I can do in the meantime. Thanks for looking into it! |
Have you considered using owning_ref for this? |
I hadn't actually, but it looks like it fulfills my needs. I'll give it a try. Thanks! |
Would it be possible to implement a
map
method on (some of) the lock guards? There has been talks about it being unsound for some implementations ofMutex
, particularly the one in the standard library, but there are ways to do it and it's a very useful feature. Do you think it would work with your particular implementation?The text was updated successfully, but these errors were encountered: