Spin-wait for another thread to finish parsing a file and return the cached result from `uri_classes_index`.
(&self, uri: &str)
| 297 | /// Spin-wait for another thread to finish parsing a file and return |
| 298 | /// the cached result from `uri_classes_index`. |
| 299 | fn wait_for_cached_result(&self, uri: &str) -> Option<Vec<Arc<ClassInfo>>> { |
| 300 | for _ in 0..200 { |
| 301 | // Check if parsing is complete (URI removed from inflight set). |
| 302 | if !self.parse_inflight.lock().contains(uri) { |
| 303 | return self.uri_classes_index.read().get(uri).cloned(); |
| 304 | } |
| 305 | std::thread::sleep(std::time::Duration::from_millis(1)); |
| 306 | } |
| 307 | // Timeout: the other thread is still parsing. Return whatever is |
| 308 | // in uri_classes_index (may be stale or None). |
| 309 | self.uri_classes_index.read().get(uri).cloned() |
| 310 | } |
| 311 | |
| 312 | /// Parse PHP source text, cache the results in |
| 313 | /// `uri_classes_index`/`use_map`/`namespace_map`, and return the extracted |
no test coverage detected