@@ -301,13 +301,17 @@ inline void pthread_exit(void *value_ptr)
301
301
{
302
302
__CPROVER_HIDE :;
303
303
if (value_ptr != 0 ) (void )* (char * )value_ptr ;
304
+ #if 0
305
+ // Destructor support is disabled as it is too expensive due to its extensive
306
+ // use of shared variables.
304
307
for (unsigned long i = 0 ; i < __CPROVER_next_thread_key ; ++ i )
305
308
{
306
309
const void * key = __CPROVER_thread_keys [i ];
307
310
__CPROVER_thread_keys [i ] = 0 ;
308
311
if (__CPROVER_thread_key_dtors [i ] && key )
309
312
__CPROVER_thread_key_dtors [i ](key );
310
313
}
314
+ #endif
311
315
__CPROVER_threads_exited [__CPROVER_thread_id ]= 1 ;
312
316
__CPROVER_assume (0 );
313
317
}
@@ -541,16 +545,24 @@ extern __CPROVER_thread_local unsigned long __CPROVER_next_thread_key;
541
545
542
546
inline void __spawned_thread (
543
547
unsigned long this_thread_id ,
548
+ #if 0
549
+ // Destructor support is disabled as it is too expensive due to its extensive
550
+ // use of shared variables.
544
551
void (* * thread_key_dtors )(void * ),
552
+ #endif
545
553
unsigned long next_thread_key ,
546
554
void * (* start_routine )(void * ),
547
555
void * arg )
548
556
{
549
557
__CPROVER_HIDE :;
550
558
__CPROVER_thread_id = this_thread_id ;
551
559
__CPROVER_next_thread_key = next_thread_key ;
560
+ #if 0
561
+ // Destructor support is disabled as it is too expensive due to its extensive
562
+ // use of shared variables.
552
563
for (unsigned long i = 0 ; i < __CPROVER_next_thread_key ; ++ i )
553
564
__CPROVER_thread_key_dtors [i ] = thread_key_dtors [i ];
565
+ #endif
554
566
#ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
555
567
// Clear all locked mutexes; locking must happen in same thread.
556
568
__CPROVER_clear_must (0 , "mutex-locked" );
@@ -566,13 +578,17 @@ __CPROVER_HIDE:;
566
578
"RRcumul" ,
567
579
"RWcumul" ,
568
580
"WRcumul" );
581
+ #if 0
582
+ // Destructor support is disabled as it is too expensive due to its extensive
583
+ // use of shared variables.
569
584
for (unsigned long i = 0 ; i < __CPROVER_next_thread_key ; ++ i )
570
585
{
571
586
const void * key = __CPROVER_thread_keys [i ];
572
587
__CPROVER_thread_keys [i ] = 0 ;
573
588
if (__CPROVER_thread_key_dtors [i ] && key )
574
589
__CPROVER_thread_key_dtors [i ](key );
575
590
}
591
+ #endif
576
592
__CPROVER_threads_exited [this_thread_id ] = 1 ;
577
593
}
578
594
@@ -598,11 +614,23 @@ inline int pthread_create(
598
614
if (attr ) (void )* attr ;
599
615
600
616
unsigned long next_thread_key = __CPROVER_next_thread_key ;
617
+ #if 0
618
+ // Destructor support is disabled as it is too expensive due to its extensive
619
+ // use of shared variables.
601
620
void (* * thread_key_dtors )(void * ) = __CPROVER_thread_key_dtors ;
621
+ #endif
602
622
603
623
__CPROVER_ASYNC_1 :
604
624
__spawned_thread (
605
- this_thread_id , thread_key_dtors , next_thread_key , start_routine , arg );
625
+ this_thread_id ,
626
+ #if 0
627
+ // Destructor support is disabled as it is too expensive due to its
628
+ // extensive use of shared variables.
629
+ thread_key_dtors ,
630
+ #endif
631
+ next_thread_key ,
632
+ start_routine ,
633
+ arg );
606
634
607
635
return 0 ;
608
636
}
@@ -895,7 +923,13 @@ inline int pthread_key_create(pthread_key_t *key, void (*destructor)(void *))
895
923
{
896
924
__CPROVER_HIDE :;
897
925
__CPROVER_thread_keys [__CPROVER_next_thread_key ] = 0 ;
926
+ #if 0
927
+ // Destructor support is disabled as it is too expensive due to its extensive
928
+ // use of shared variables.
898
929
__CPROVER_thread_key_dtors [__CPROVER_next_thread_key ] = destructor ;
930
+ #else
931
+ __CPROVER_precondition (destructor == 0 , "destructors are not yet supported" );
932
+ #endif
899
933
* key = __CPROVER_next_thread_key ++ ;
900
934
return 0 ;
901
935
}
0 commit comments