Skip to content

pipes::peek returns true unexpectedly #3905

Closed
@brson

Description

@brson
extern mod std;
use core::pipes::*;
use std::comm::DuplexStream;
use core::task;

fn main () {
    let (chan, port): (Chan<int>, Port<int>) = stream();

    do task::spawn() |move port| {
        assert port.recv() == 123;
        assert !port.peek();
    }

    chan.send(123);
}

There is no message available but peek returns true, likely because this: https://github.com/mozilla/rust/blob/incoming/src/libcore/pipes.rs#L516

I expect that anytime peek returns true I can call recv successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions