------------------------------------------------------------------------ Methods of affinity_partitioner_base_v3 ------------------------------------------------------------------------
| 160 | // Methods of affinity_partitioner_base_v3 |
| 161 | //------------------------------------------------------------------------ |
| 162 | void affinity_partitioner_base_v3::resize( unsigned factor ) { |
| 163 | // Check factor to avoid asking for number of workers while there might be no arena. |
| 164 | size_t new_size = factor ? factor*(1+governor::local_scheduler()->number_of_workers_in_my_arena()) : 0; |
| 165 | if( new_size!=my_size ) { |
| 166 | if( my_array ) { |
| 167 | NFS_Free( my_array ); |
| 168 | // Following two assignments must be done here for sake of exception safety. |
| 169 | my_array = NULL; |
| 170 | my_size = 0; |
| 171 | } |
| 172 | if( new_size ) { |
| 173 | my_array = static_cast<affinity_id*>(NFS_Allocate(new_size,sizeof(affinity_id), NULL )); |
| 174 | memset( my_array, 0, sizeof(affinity_id)*new_size ); |
| 175 | my_size = new_size; |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | } // namespace internal |
| 181 |
no test coverage detected