Relative Content

Tag Archive for multithreadingrustconcurrencymessage

Control thread from another thread leads to unexpected behavior in Rust

I am quite new to concurrent programming, threads, shared memory, message passing and so on.
In my example certain events are not handled (messages are not printed) and I don’t understand why.
To motivate my code a little: The problem I want to solve (currently) is only a simple blinking LED connected to a Raspberry Pi. The main thread is a web server (axum) that handles messages and changes the led-state accordingly. I want to run the LED-control-code in another thread that listens to messages sent over a channel: