Referring to #90, I hope this example is considered useful.
Example for a global variable in a shared library. #183
funny0facer/example_for_global_variable into master
Hmm, I'm not entirely convinced that this is a worthwhile example. spin is specifically not intended for guarding state in a multi-threaded hosted environment: std::sync should be used instead due to concerns like priority inversion. While it's sound to do so, it's almost never a good idea.
@ -0,0 +1,111 @@
//! This example is focused on the "library" part and not on the "main" function.
There are some typos and grammatical issues here, and in other comments.
@ -0,0 +1,111 @@
//! This example is focused on the "library" part and not on the "main" function.
fair point, maybe I tried to oversimplify the example.
I built https://github.com/funny0facer/esp32_interrupts1 and there I use your Mutex to lock a global variable.
Maybe you like the new version better.. I focused it now on the use case mentioned on https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html
I added also an example for spin::Once.
Please let me know if this kind of example is even the thing you were looking for or if you expect something different.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?