Add a rendezvous to the process, returning the handle
(&self, rendezvous: Arc<RwLock<Rendezvous>>)
| 226 | |
| 227 | /// Add a rendezvous to the process, returning the handle |
| 228 | pub fn give_rendezvous(&self, rendezvous: Arc<RwLock<Rendezvous>>) -> usize { |
| 229 | // Lock the handles |
| 230 | let handles = &mut self.process.write().handles; |
| 231 | |
| 232 | // Find empty handle slot |
| 233 | for (pos, handle) in handles.iter().enumerate() { |
| 234 | if handle.is_none() { |
| 235 | // Found empty slot => Store rendezvous |
| 236 | handles[pos] = Some(rendezvous); |
| 237 | return pos; |
| 238 | } |
| 239 | } |
| 240 | // All full => Add new handle |
| 241 | handles.push(Some(rendezvous)); |
| 242 | handles.len() - 1 |
| 243 | } |
| 244 | |
| 245 | /// Get the physical address and page table level of the memory |
| 246 | /// chunk containing the given virtual address |
no test coverage detected