Skip to content

Add a get-or-insert method #6

@svenstaro

Description

@svenstaro

Hey, super cool library. I really like the idea!

I'm missing an atomic get-or-insert method, though. I haven't look at this library's internals yet but I think it could work like:

  1. Lock the shmap
  2. Get value if exists
  3. Insert using provided function/value otherwise
  4. Unlock the shmap

I think it should be doable.

Currently I'm implementing this using an external lock around the shmap (which kind of defeats the purpose).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions