@@ -12,8 +12,8 @@ mod context;
1212pub ( crate ) mod driver;
1313
1414use crate :: runtime:: driver:: Handle ;
15+ use crate :: Builder ;
1516pub ( crate ) use context:: RuntimeContext ;
16- use crate :: { Builder } ;
1717
1818type Context = Arc < RuntimeContext > ;
1919
@@ -43,7 +43,7 @@ pub struct Runtime {
4343 signal : Arc < Notify > ,
4444
4545 /// Builder for runtime contexts
46- builder : Builder
46+ builder : Builder ,
4747}
4848
4949/// Spawns a new asynchronous task, returning a [`JoinHandle`] for it.
@@ -109,7 +109,7 @@ impl Runtime {
109109 tokio_rt : MaybeUninit :: zeroed ( ) ,
110110 contexts : Default :: default ( ) ,
111111 builder : builder. clone ( ) ,
112- signal : Arc :: new ( Notify :: new ( ) )
112+ signal : Arc :: new ( Notify :: new ( ) ) ,
113113 } ;
114114
115115 let on_thread_start = runtime. create_on_thread_start_callback ( ) ;
@@ -128,7 +128,7 @@ impl Runtime {
128128 runtime. start_uring_wakes_task ( ) ;
129129
130130 CONTEXT . with ( |x| {
131- x. set_handle ( Handle :: new ( & builder) . expect ( "Internal error" ) ) ;
131+ x. set_handle ( Handle :: new ( builder) . expect ( "Internal error" ) ) ;
132132 x. set_on_thread_park ( Runtime :: on_thread_park) ;
133133 let mut lock = runtime. contexts . lock ( ) . unwrap ( ) ;
134134 lock. push_back ( x. clone ( ) ) ;
@@ -139,12 +139,12 @@ impl Runtime {
139139 Ok ( runtime)
140140 }
141141
142- fn on_thread_park ( ) {
142+ fn on_thread_park ( ) {
143143 CONTEXT . with ( |x| {
144144 let _ = x. handle ( ) . flush ( ) ;
145145 } ) ;
146146 }
147-
147+
148148 fn create_on_thread_start_callback ( & self ) -> impl Fn ( ) + Sync + ' static {
149149 let is_unique = |item : & Context , list : & LinkedList < Context > | {
150150 let item_fd = item. handle ( ) . as_raw_fd ( ) ;
@@ -182,27 +182,25 @@ impl Runtime {
182182 //SAFETY: It's always already initialized on Runtime::new method
183183 let tokio_rt = unsafe { self . tokio_rt . assume_init_ref ( ) } ;
184184 let _guard = tokio_rt. enter ( ) ;
185- self . local . spawn_local (
186- Runtime :: drive_uring_wakes (
187- self . contexts . clone ( ) ,
188- self . signal . clone ( ) ,
189- self . builder . threads
190- )
191- ) ;
185+ self . local . spawn_local ( Runtime :: drive_uring_wakes (
186+ self . contexts . clone ( ) ,
187+ self . signal . clone ( ) ,
188+ self . builder . threads ,
189+ ) ) ;
192190 }
193191
194192 async fn drive_uring_wakes (
195193 contexts : Arc < Mutex < LinkedList < Context > > > ,
196194 signal : Arc < Notify > ,
197- threads : usize
195+ threads : usize ,
198196 ) {
199197 let mut total = 0 ;
200198
201199 while total != threads + 1 {
202200 signal. notified ( ) . await ;
203201
204202 let mut guard = contexts. lock ( ) . unwrap ( ) ;
205-
203+
206204 for i in guard. iter ( ) {
207205 tokio:: spawn ( Runtime :: wait_event ( Item :: new ( i. clone ( ) ) ) ) ;
208206 total += 1 ;
@@ -262,8 +260,8 @@ impl Drop for Runtime {
262260
263261#[ cfg( test) ]
264262mod test {
265- use crate :: builder;
266263 use super :: * ;
264+ use crate :: builder;
267265
268266 #[ test]
269267 fn block_on ( ) {
0 commit comments