Skip to content
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

Ability to "mlock" the buffer? #3

Open
mgeier opened this issue Nov 5, 2020 · 0 comments
Open

Ability to "mlock" the buffer? #3

mgeier opened this issue Nov 5, 2020 · 0 comments

Comments

@mgeier
Copy link
Owner

mgeier commented Nov 5, 2020

The JACK ring buffer provides this, see https://jackaudio.org/api/ringbuffer_8h.html#aeb059ff23c65389d48ebbe948f05c2b2.

The libc crate seems to be able to do this:

https://docs.rs/libc/0.2.79/libc/fn.mlock.html
https://docs.rs/libc/0.2.79/libc/fn.munlock.html

It should be simple to add this as a method to RingBuffer.

The JACK wrapper also provides it:

https://docs.rs/jack/0.7.0/jack/struct.RingBuffer.html#method.mlock

Windows might need special treatment with https://docs.rs/winapi/0.3.9/winapi/um/memoryapi/fn.VirtualLock.html?

Do we have to expose mlock() as unsafe?

Probably it would be better to simply provide an (unsafe?) method to expose the underlying memory as a pointer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant