@@ -2509,11 +2509,43 @@ def test_compress_shared_dict(self):
25092509        num_threads  =  8 
25102510
25112511        def  run_method (b ):
2512-             level  =  threading .get_ident () %  2 
2512+             level  =  threading .get_ident () %  4 
25132513            # sync threads to increase chance of contention on 
25142514            # capsule storing dictionary levels 
25152515            b .wait ()
2516-             ZstdCompressor (level = level , zstd_dict = TRAINED_DICT .as_digested_dict )
2516+             ZstdCompressor (level = level ,
2517+                            zstd_dict = TRAINED_DICT .as_digested_dict )
2518+             b .wait ()
2519+             ZstdCompressor (level = level ,
2520+                            zstd_dict = TRAINED_DICT .as_undigested_dict )
2521+             b .wait ()
2522+             ZstdCompressor (level = level ,
2523+                            zstd_dict = TRAINED_DICT .as_prefix )
2524+         threads  =  []
2525+ 
2526+         b  =  threading .Barrier (num_threads )
2527+         for  i  in  range (num_threads ):
2528+             thread  =  threading .Thread (target = run_method , args = (b ,))
2529+ 
2530+             threads .append (thread )
2531+ 
2532+         with  threading_helper .start_threads (threads ):
2533+             pass 
2534+ 
2535+     @threading_helper .reap_threads  
2536+     @threading_helper .requires_working_threading () 
2537+     def  test_decompress_shared_dict (self ):
2538+         num_threads  =  8 
2539+ 
2540+         def  run_method (b ):
2541+             # sync threads to increase chance of contention on 
2542+             # decompression dictionary 
2543+             b .wait ()
2544+             ZstdDecompressor (zstd_dict = TRAINED_DICT .as_digested_dict )
2545+             b .wait ()
2546+             ZstdDecompressor (zstd_dict = TRAINED_DICT .as_undigested_dict )
2547+             b .wait ()
2548+             ZstdDecompressor (zstd_dict = TRAINED_DICT .as_prefix )
25172549        threads  =  []
25182550
25192551        b  =  threading .Barrier (num_threads )
0 commit comments