11use core:: { future:: Future , pin:: Pin , task:: { Context , Poll } } ;
22use alloc:: boxed:: Box ;
3- use crossbeam_queue:: ArrayQueue ;
4- use conquer_once:: spin:: OnceCell ;
5- use crate :: vfs:: CachedVfsBlock ;
63
74pub mod executor;
85pub mod keyboard;
@@ -22,39 +19,4 @@ impl Task {
2219 fn poll ( & mut self , context : & mut Context ) -> Poll < ( ) > {
2320 self . future . as_mut ( ) . poll ( context)
2421 }
25- }
26-
27- #[ derive( Clone , Copy ) ]
28- pub struct CryptoVerificationJob {
29- pub block_ptr : * mut CachedVfsBlock ,
30- pub expected_hash : [ u8 ; 32 ] ,
31- }
32-
33- // Explicitly implement Send and Sync to allow transmission through the lock-free ArrayQueue
34- unsafe impl Send for CryptoVerificationJob { }
35- unsafe impl Sync for CryptoVerificationJob { }
36-
37- // Global thread-safe async queue for block validation
38- pub static VERIFICATION_QUEUE : OnceCell < ArrayQueue < CryptoVerificationJob > > = OnceCell :: uninit ( ) ;
39-
40- /// Publicly exposes queue initialization to external modules like main.rs
41- pub fn init_queue ( ) {
42- VERIFICATION_QUEUE . init_once ( || ArrayQueue :: new ( 32 ) ) ;
43- }
44-
45- pub fn spawn_provenance_worker ( ) {
46- loop {
47- if let Some ( queue) = VERIFICATION_QUEUE . get ( ) {
48- if let Some ( job) = queue. pop ( ) {
49- unsafe {
50- crate :: provenance:: process_next_provenance_job ( job) ;
51- }
52- }
53- }
54- core:: hint:: spin_loop ( ) ;
55- }
56- }
57-
58- pub fn yield_current_thread ( ) {
59- core:: hint:: spin_loop ( ) ;
6022}
0 commit comments