pub fn run(main: proc()) -> int {
    // Create a scheduler pool and spawn the main task into this pool. We will
    // get notified over a channel when the main task exits.
    let mut pool = SchedPool::new(PoolConfig::new());
    let (port, chan) = Chan::new();
    let mut opts = TaskOpts::new();
    opts.notify_chan = Some(chan);
    opts.name = Some(SendStrStatic("<main>"));
    pool.spawn(opts, main);

    // Wait for the main task to return, and set the process error code
    // appropriately.
    if port.recv().is_err() {
        os::set_exit_status(rt::DEFAULT_ERROR_CODE);
    }

    // Now that we're sure all tasks are dead, shut down the pool of schedulers,
    // waiting for them all to return.
    pool.shutdown();
    os::get_exit_status()
}
/// Execute the main function in a pool of M:N schedulers.
///
/// Configures the runtime according to the environment, by default using a task
/// scheduler with the same number of threads as cores.  Returns a process exit
/// code.
///
/// This function will not return until all schedulers in the associated pool
/// have returned.
Execute the main function in a pool of M:N schedulers.
Configures the runtime according to the environment, by default using a task
scheduler with the same number of threads as cores.  Returns a process exit
code.

This function will not return until all schedulers in the associated pool
have returned.
Execute the main function in a pool of M : N schedulers . Configures the runtime according to the environment by default using a task scheduler with the same number of threads as cores . Returns a process exit code . This function will not return until all schedulers in the associated pool have returned .
pub fn run(main: proc()) -> int {
    // Create a scheduler pool and spawn the main task into this pool. We will
    // get notified over a channel when the main task exits.
    let mut pool = SchedPool::new(PoolConfig::new());
    let (port, chan) = Chan::new();
    let mut opts = TaskOpts::new();
    opts.notify_chan = Some(chan);
    opts.name = Some(SendStrStatic("<main>"));
    pool.spawn(opts, main);
    // Wait for the main task to return, and set the process error code
    // appropriately.
    if port.recv().is_err() {
        os::set_exit_status(rt::DEFAULT_ERROR_CODE);
    }
    // Now that we're sure all tasks are dead, shut down the pool of schedulers,
    // waiting for them all to return.
    pool.shutdown();
    os::get_exit_status()
}
pub fn run ( main : proc ( ) ) -> int { // Create a scheduler pool and spawn the main task into this pool. We will // get notified over a channel when the main task exits. let mut pool = SchedPool :: new ( PoolConfig :: new ( ) ) ; let ( port , chan ) = Chan :: new ( ) ; let mut opts = TaskOpts :: new ( ) ; opts . notify_chan = Some ( chan ) ; opts . name = Some ( SendStrStatic ( " " ) ) ; pool . spawn ( opts , main ) ; // Wait for the main task to return, and set the process error code // appropriately. if port . recv ( ) . is_err ( ) { os :: set_exit_status ( rt :: DEFAULT_ERROR_CODE ) ; } // Now that we're sure all tasks are dead, shut down the pool of schedulers, // waiting for them all to return. pool . shutdown ( ) ; os :: get_exit_status ( ) }
Execute the main function in a pool of M:N schedulers.
Execute the main function in a pool of M : N schedulers .
main
proc()
main
proc()