fn insert_machine(&mut self, machine: ShareableMachine, stats: &mut SchedStats) {
        let t = Instant::now();
        let entry = self.machines.vacant_entry();
        log::trace!("inserted machine {} key={}", machine.get_id(), entry.key());
        machine.key.store(entry.key(), Ordering::SeqCst);
        entry.insert(Arc::clone(&machine));

        // Always run a task, on insertion so that the machine gets the one-time
        // connection notification. Otherwise, it would have to wait for a send.
        if let Err(state) = machine.compare_and_exchange_state(MachineState::New, MachineState::Ready) {
            log::error!("insert_machine: expected state New, found state {:#?}", state);
        }
        live_machine_count.fetch_add(1, Ordering::SeqCst);
        schedule_machine(machine, &self.run_queue);
        stats.add_time += t.elapsed();
    }
// insert a machine into the machines map, this is where the machine.key is set
insert a machine into the machines map, this is where the machine.key is set
insert a machine into the machines map this is where the machine . key is set
fn insert_machine(&mut self, machine: ShareableMachine, stats: &mut SchedStats) {
        let t = Instant::now();
        let entry = self.machines.vacant_entry();
        log::trace!("inserted machine {} key={}", machine.get_id(), entry.key());
        machine.key.store(entry.key(), Ordering::SeqCst);
        entry.insert(Arc::clone(&machine));
        // Always run a task, on insertion so that the machine gets the one-time
        // connection notification. Otherwise, it would have to wait for a send.
        if let Err(state) = machine.compare_and_exchange_state(MachineState::New, MachineState::Ready) {
            log::error!("insert_machine: expected state New, found state {:#?}", state);
        }
        live_machine_count.fetch_add(1, Ordering::SeqCst);
        schedule_machine(machine, &self.run_queue);
        stats.add_time += t.elapsed();
    }
fn insert_machine ( & mut self , machine : ShareableMachine , stats : & mut SchedStats ) { let t = Instant :: now ( ) ; let entry = self . machines . vacant_entry ( ) ; log :: trace ! ( " " machine get_id ( ) entry key ( ) ) ; machine . key . store ( entry . key ( ) , Ordering :: SeqCst ) ; entry . insert ( Arc :: clone ( & machine ) ) ; // Always run a task, on insertion so that the machine gets the one-time // connection notification. Otherwise, it would have to wait for a send. if let Err ( state ) = machine . compare_and_exchange_state ( MachineState :: New , MachineState :: Ready ) { log :: error ! ( " " state ) ; } live_machine_count . fetch_add ( 1 , Ordering :: SeqCst ) ; schedule_machine ( machine , & self . run_queue ) ; stats . add_time += t . elapsed ( ) ; }
insert a machine into the machines map, this is where the machine.key is set
insert a machine into the machines map this is where the machine . key is set
&mut self
machine
ShareableMachine
stats
&mut SchedStats