@@ -457,17 +457,11 @@ where
457
457
458
458
#[ cfg( test) ]
459
459
mod tests {
460
-
461
460
use std:: ffi:: CString ;
462
- use std:: io:: Write ;
463
-
464
- use stdext:: spawn;
465
461
466
462
use super :: * ;
467
463
use crate :: assert_match;
468
- use crate :: r_lock;
469
464
use crate :: r_test;
470
- use crate :: r_test_unlocked;
471
465
use crate :: utils:: r_envir_remove;
472
466
use crate :: utils:: r_is_null;
473
467
@@ -528,44 +522,6 @@ mod tests {
528
522
}
529
523
}
530
524
531
- #[ test]
532
- fn test_threads ( ) {
533
- // TODO: Switch to `r_task()`
534
- r_test_unlocked ! {
535
-
536
- // Spawn a bunch of threads that try to interact with R.
537
- const N : i32 = 1000 ;
538
- let mut handles : Vec <_> = Vec :: new( ) ;
539
- for i in 1 ..20 {
540
- let handle = spawn!( format!( "test_exec_test_threads_{}" , i) , move || {
541
- let id = std:: thread:: current( ) . id( ) ;
542
- for _j in 1 ..20 {
543
- r_lock! {
544
- println!( "Thread {:?} acquiring R lock." , id) ;
545
- std:: io:: stdout( ) . flush( ) . unwrap( ) ;
546
- let mut protect = RProtect :: new( ) ;
547
- let code = protect. add( Rf_lang2 ( r_symbol!( "rnorm" ) , Rf_ScalarInteger ( N ) ) ) ;
548
- println!( "Thread {:?} about to evaluate R code." , id) ;
549
- std:: io:: stdout( ) . flush( ) . unwrap( ) ;
550
- let result = protect. add( Rf_eval ( code, R_GlobalEnv ) ) ;
551
- println!( "Thread {:?} finished evaluating R code." , id) ;
552
- std:: io:: stdout( ) . flush( ) . unwrap( ) ;
553
- assert!( Rf_length ( result) == N ) ;
554
- println!( "Thread {:?} releasing R lock." , std:: thread:: current( ) . id( ) ) ;
555
- std:: io:: stdout( ) . flush( ) . unwrap( ) ;
556
- } ;
557
- }
558
- } ) ;
559
- handles. push( handle) ;
560
- }
561
-
562
- for handle in handles {
563
- handle. join( ) . unwrap( ) ;
564
- }
565
-
566
- }
567
- }
568
-
569
525
#[ test]
570
526
fn test_try_catch_error ( ) {
571
527
r_test ! {
0 commit comments