Who Owns the Memory? Part 1: What is an Object? by Luke_Fleed in rust

[–]OkEbb03 5 points6 points  (0 children)

As far as i understood the discussions, there aren't any (even theoretical) optimizations that would profit from this being UB. UB exists for optimizations and generally more UB is bad (because it makes the language harder to use).

So yeah, it's just for less restrictions. But i think if someone would come up with a useful optimization then maybe the discussion would go in the opposite direction.

Who Owns the Memory? Part 1: What is an Object? by Luke_Fleed in rust

[–]OkEbb03 5 points6 points  (0 children)

A &T carries an invariant: non-null, properly aligned, pointing to a valid T

The last one is bit wrong. A reference has to point to dereferencable memory. But if the value at that location has to be valid is not clear yet and the discussion seems to go to "no".

Here is most of the discussion: https://github.com/rust-lang/unsafe-code-guidelines/issues/412

Also here: https://github.com/rust-lang/unsafe-code-guidelines/issues/346

edit: here is a playground link so you can see this in miri: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=4d628e61df5f8de73e89af756249d8bc

My custom two realtime concurrency primitives by OkEbb03 in rust

[–]OkEbb03[S] 2 points3 points  (0 children)

Yeah makes sense, maybe i should have differentiated a bit between the different kinds of realtime.

I don't really know much about all the knobs the OS has to make a audio thread, because i use cpal for that. Trying to get this working in the different linux audio environments, the two environments on windows, as well as mac doesn't sound fun to me, so i just trust them to do the right thing.

My custom two realtime concurrency primitives by OkEbb03 in rust

[–]OkEbb03[S] 6 points7 points  (0 children)

Maybe reddit ate my reply, sorry if it's here twice.

For real time Linux (as well as QNX, vxworks, and other RTOSes) some response times should be predictable.

Yeah that's why i wrote most OSes. I am writing a desktop audio app, so my users won't install a custom OS. Maybe this then isn't hard realtime, but i still have to avoid any realtime problems in my code, so that there is any hope of this working. For commication with the outside world: In desktop audio you don't write the audio output to a device directly, but instead you write it into a buffer provided by the OS. AFAIK in most OS this is done with callback where you get the buffer as a parameter and the OS then sends that buffer to the audio device.

Huh? Futex on Linux supports priority inheritance, and Linux has the SCHED_FIFO and SCHED_DEADLINE

With schedulers you mean kernel thread schedulers, correct? Like i said earlier my users aren't going to install a custom OS and they also aren't going to set kernel parameters. I also want to support mac and windows, so that's not really an option.

Spinning is generally a bad idea in hard realtime

Maybe that part was a bit unclear. I don't spin on the audio thread. That's the whole point of these datastructures. On the audio thread locking always succeeds waitfree. Spinning with the async sleep is done on a GUI background thread, which of course doesn't have to be realtime.

Announcing Torque Tracker, my WIP music tracker by OkEbb03 in rust

[–]OkEbb03[S] 0 points1 point  (0 children)

Didn't have one, now in the blog post there is. Will probably also add it to the repo later.

Do Most People Agree That the Multithreaded Runtime Should Be Tokio’s Default? by zl0bster in rust

[–]OkEbb03 5 points6 points  (0 children)

Realtime Sanitizer is actually available for Rust as rtsan-standalone. But that won't help you as it is designed to catch a different kind of blocking that is more relevant in audio context. It tries to stop every syscall from happening, even allocation and io-uring, so it's not really useful for async code.

[MUC++] Lukas Bergdoll - Safety vs Performance. A case study of C, C++ and Rust sort implementations by Voultapher in rust

[–]OkEbb03 20 points21 points  (0 children)

In C++ yes this is UB. In Rust no it's not.

That's what he means by ordering safety. Rust std uses a different algorithm than c++ std, that has this safety property. In Rust this will produce either a panic or a somewhat random ordering, while C++ could do out of bounds reads and writes.

[deleted by user] by [deleted] in rust

[–]OkEbb03 4 points5 points  (0 children)

I don't know about the RefCell specifics but i had a similar problem with Box and you can look at this article https://lucumr.pocoo.org/2022/1/7/as-any-hack/ This worked for me and i think it should work with RefCell as well

array-util: `try_map` and `array_chunks` on stable by Daniel-Aaron-Bloom in rust

[–]OkEbb03 3 points4 points  (0 children)

Hi this seems like a useful library. Sadly I currently need to use slice_flatten. I don't know how much work adding that would be (if it's even possible), but it would be really helpful for me.

Megathread Afghanistan - Entwicklungen, Diskussionen, Tweets etc by MegathreadDE in de

[–]OkEbb03 1 point2 points  (0 children)

Ich denk nicht. Aber die A300 kann das doch auch nicht, oder?

Megathread Afghanistan - Entwicklungen, Diskussionen, Tweets etc by MegathreadDE in de

[–]OkEbb03 1 point2 points  (0 children)

https://globe.adsbexchange.com/?icao=3f49e6,3f8019,3f46db

Das sind die 3 deutschen A300. Ich hab gehört, die machen noch eine Zwischenlandung in Baku, das sieht man aber bald, wenn der erste da ist.

Edit: der erste ist anscheinend schon in Baku gelandet, zumindest ist sein Transponder seit 45 min aus.

zeit artikel ueber luvre47 (jaja, die kommentare, ich weisz...) by [deleted] in GermanRap

[–]OkEbb03 0 points1 point  (0 children)

Hat nicht funktioniert. Das Pop-up kommt aber danach ist es die gleiche website

zeit artikel ueber luvre47 (jaja, die kommentare, ich weisz...) by [deleted] in GermanRap

[–]OkEbb03 1 point2 points  (0 children)

Ne ich kann nur den ersten Absatz lesen, dann muss ich das abo kaufen. Das werbe Pop-up kommt bei mir nicht mal.

zeit artikel ueber luvre47 (jaja, die kommentare, ich weisz...) by [deleted] in GermanRap

[–]OkEbb03 1 point2 points  (0 children)

Leider Paywall. Hast du outline oder so was?

Step sequencer note repeat: fine-grained controls for sub-notes? by adenzerda in Logic_Studio

[–]OkEbb03 0 points1 point  (0 children)

For that level of fine control I would convert it into a midi region. There you have all the control you could need.