File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,8 @@ pub fn uring_builder() -> io_uring::Builder {
164164#[ derive( Clone ) ]
165165pub struct Builder {
166166 entries : u32 ,
167- threads : usize ,
167+ worker_threads : usize ,
168+ thread_stack_size : usize ,
168169 urb : io_uring:: Builder ,
169170}
170171
@@ -177,7 +178,8 @@ pub struct Builder {
177178pub fn builder ( ) -> Builder {
178179 Builder {
179180 entries : 256 ,
180- threads : std:: thread:: available_parallelism ( ) . unwrap ( ) . get ( ) ,
181+ worker_threads : std:: thread:: available_parallelism ( ) . unwrap ( ) . get ( ) ,
182+ thread_stack_size : 20971520 ,
181183 urb : io_uring:: IoUring :: builder ( ) ,
182184 }
183185}
@@ -205,7 +207,13 @@ impl Builder {
205207
206208 /// Replaces the default number of worker threads
207209 pub fn worker_threads ( & mut self , num : usize ) -> & mut Self {
208- self . threads = num;
210+ self . worker_threads = num;
211+ self
212+ }
213+
214+ /// Replaces the default number of worker threads stack size
215+ pub fn thread_stack_size ( & mut self , num : usize ) -> & mut Self {
216+ self . worker_threads = num;
209217 self
210218 }
211219
Original file line number Diff line number Diff line change @@ -120,7 +120,8 @@ impl Runtime {
120120 let on_thread_start = runtime. create_on_thread_start_callback ( ) ;
121121
122122 let rt = tokio:: runtime:: Builder :: new_multi_thread ( )
123- . worker_threads ( builder. threads )
123+ . worker_threads ( builder. worker_threads )
124+ . thread_stack_size ( builder. thread_stack_size )
124125 . on_thread_start ( on_thread_start)
125126 . on_thread_park ( Runtime :: on_thread_park)
126127 . enable_all ( )
@@ -191,7 +192,7 @@ impl Runtime {
191192 self . local . spawn_local ( Runtime :: drive_uring_wakes (
192193 self . contexts . clone ( ) ,
193194 self . signal . clone ( ) ,
194- self . builder . threads ,
195+ self . builder . worker_threads ,
195196 ) ) ;
196197 }
197198
You can’t perform that action at this time.
0 commit comments