Insert a new task into the running map and push it onto the ready queue.
(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>)
| 114 | impl Tasks { |
| 115 | /// Insert a new task into the running map and push it onto the ready queue. |
| 116 | pub fn insert(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>) { |
| 117 | let id = { |
| 118 | let mut c = self.counter.lock().unwrap(); |
| 119 | let id = *c; |
| 120 | *c += 1; |
| 121 | id |
| 122 | }; |
| 123 | self.running.lock().unwrap().insert(id, Arc::new(Task { future: Mutex::new(future) })); |
| 124 | self.queue(id); |
| 125 | } |
| 126 | |
| 127 | /// Push a task ID onto the ready queue (called by `TaskWaker`). |
| 128 | pub fn queue(&self, id: u128) { |
no test coverage detected