@@ -1024,38 +1024,39 @@ int BLASFUNC(blas_thread_shutdown)(void){
1024
1024
1025
1025
int i ;
1026
1026
1027
- if (!blas_server_avail ) return 0 ;
1028
-
1029
1027
LOCK_COMMAND (& server_lock );
1030
1028
1031
- for ( i = 0 ; i < blas_num_threads - 1 ; i ++ ) {
1029
+ if ( blas_server_avail ) {
1032
1030
1031
+ for (i = 0 ; i < blas_num_threads - 1 ; i ++ ) {
1033
1032
1034
- pthread_mutex_lock (& thread_status [i ].lock );
1035
1033
1036
- atomic_store_queue (& thread_status [i ].queue , (blas_queue_t * )-1 );
1037
- thread_status [i ].status = THREAD_STATUS_WAKEUP ;
1038
- pthread_cond_signal (& thread_status [i ].wakeup );
1034
+ pthread_mutex_lock (& thread_status [i ].lock );
1039
1035
1040
- pthread_mutex_unlock (& thread_status [i ].lock );
1036
+ atomic_store_queue (& thread_status [i ].queue , (blas_queue_t * )-1 );
1037
+ thread_status [i ].status = THREAD_STATUS_WAKEUP ;
1038
+ pthread_cond_signal (& thread_status [i ].wakeup );
1041
1039
1042
- }
1040
+ pthread_mutex_unlock ( & thread_status [ i ]. lock );
1043
1041
1044
- for (i = 0 ; i < blas_num_threads - 1 ; i ++ ){
1045
- pthread_join (blas_threads [i ], NULL );
1046
- }
1042
+ }
1047
1043
1048
- for (i = 0 ; i < blas_num_threads - 1 ; i ++ ){
1049
- pthread_mutex_destroy (& thread_status [i ].lock );
1050
- pthread_cond_destroy (& thread_status [i ].wakeup );
1051
- }
1044
+ for (i = 0 ; i < blas_num_threads - 1 ; i ++ ){
1045
+ pthread_join (blas_threads [i ], NULL );
1046
+ }
1047
+
1048
+ for (i = 0 ; i < blas_num_threads - 1 ; i ++ ){
1049
+ pthread_mutex_destroy (& thread_status [i ].lock );
1050
+ pthread_cond_destroy (& thread_status [i ].wakeup );
1051
+ }
1052
1052
1053
1053
#ifdef NEED_STACKATTR
1054
- pthread_attr_destory (& attr );
1054
+ pthread_attr_destroy (& attr );
1055
1055
#endif
1056
1056
1057
- blas_server_avail = 0 ;
1057
+ blas_server_avail = 0 ;
1058
1058
1059
+ }
1059
1060
UNLOCK_COMMAND (& server_lock );
1060
1061
1061
1062
return 0 ;
0 commit comments