Skip to content

Timer periodic method can cause a weird failure #10375

Closed
@mstewartgallus

Description

@mstewartgallus

The following code sometimes causes a weird failure on exit. The error:


You've met with a terrible fate, haven't you?

fatal runtime error: type error: used SchedTask as GreenTask
aborted

The code:

use std::rt::io::timer::Timer;
use std::task;

pub fn main() {
    let mut timer = Timer::new().expect("Expected a timer");
    let timer_port = timer.periodic(1000);

    do {
        let mut task = task::task();
        task.name("Timer Port Listener");
        task
    }.spawn_with(timer_port) |timer_port| {
        loop {
            timer_port.try_recv();
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions