Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From the end of the last post in the series (http://winningraceconditions.blogspot.com/2012/09/rust-4-typ...):

    let arc = RWARC(some_data);
    for num_cpus().times {
        let arc2 = clone(&arc);
        do task::spawn |move arc2| {
            process_data(arc2); // might read, write, whatever
        }
    }
    let modified_data = unwrap(move arc); // blocks on all child tasks at once
    // do more of the algorithm, etc.
This is a nice fork/join pattern, allowing implementations with minimal copying and reasonable safety. If this is indicative of design decisions made by the creators of Rust, I think it looks pretty good.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: