Skip to content

Multilock doesn't seem to work in an infinite loop #1126

@wt

Description

@wt

The following fails, while the commented version works:

    async fn blink(
        blink::Context {
            shared:
                blink::SharedResources {
                    mut red_led,
                    mut usb_serial,
                    ..
                },
            ..
        }: blink::Context,
    ) {
        loop {
            (&red_led, &usb_serial).lock(|led, s| {
                led.toggle().unwrap();
                let _ = s.write(b"fjdklsf");
            });
            // usb_serial.lock(|s| {
            //     red_led.lock(|led| {
            //         led.toggle().unwrap();
            //         let _ = s.write(b"fjdklsf");
            //     })
            // });
            Mono::delay(2u64.secs()).await;
       }
    }

I would have expected both of these to work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions