File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -45,3 +45,7 @@ required-features = ["rayon"]
45
45
[[test ]]
46
46
name = " rayon-1"
47
47
required-features = [" rayon" ]
48
+
49
+ [[test ]]
50
+ name = " rayon-2"
51
+ required-features = [" rayon" ]
Original file line number Diff line number Diff line change
1
+ //! Must be a separate test because it modifies the _global_ rayon pool.
2
+ use std:: { fs:: File , path:: Path } ;
3
+ use jpeg_decoder:: Decoder ;
4
+
5
+ #[ test]
6
+ fn decoding_in_global_pool ( ) {
7
+ let path = Path :: new ( "tests/reftest/images/progressive3.jpg" ) ;
8
+
9
+ rayon:: ThreadPoolBuilder :: new ( )
10
+ . num_threads ( 2 )
11
+ . build_global ( )
12
+ . unwrap ( ) ;
13
+
14
+ let _: Vec < _ > = ( 0 ..1024 )
15
+ . map ( |_| {
16
+ let path = path. clone ( ) ;
17
+ std:: thread:: spawn ( move || {
18
+ let mut decoder = Decoder :: new ( File :: open ( & path) . unwrap ( ) ) ;
19
+ let _ = decoder. decode ( ) . unwrap ( ) ;
20
+ } ) ;
21
+ } ) . collect ( ) ;
22
+ }
23
+
You can’t perform that action at this time.
0 commit comments