Changeset 65591
- Timestamp:
- Jul 14, 2015, 8:18:21 PM (9 years ago)
- File:
-
- 1 edited
-
grass/trunk/raster/r.mapcalc/map.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/raster/r.mapcalc/map.c
r63859 r65591 72 72 static int num_maps; 73 73 static int max_maps; 74 static int masking; 74 75 75 76 static int min_row = INT_MAX; … … 82 83 #ifdef HAVE_PTHREAD_H 83 84 static pthread_mutex_t cats_mutex; 84 #endif 85 86 /****************************************************************************/ 85 static pthread_mutex_t mask_mutex; 86 #endif 87 88 /****************************************************************************/ 89 90 static void read_row(int fd, void *buf, int row, int res_type) 91 { 92 #ifdef HAVE_PTHREAD_H 93 if (masking) 94 pthread_mutex_lock(&mask_mutex); 95 #endif 96 Rast_get_row(fd, buf, row, res_type); 97 #ifdef HAVE_PTHREAD_H 98 if (masking) 99 pthread_mutex_unlock(&mask_mutex); 100 #endif 101 } 87 102 88 103 static void cache_sub_init(struct row_cache *cache, int data_type) … … 146 161 if (i >= 0 && i < cache->nrows) { 147 162 if (!sub->valid[i]) { 148 Rast_get_row(cache->fd, sub->buf[i], row + i, data_type);163 read_row(cache->fd, sub->buf[i], row + i, data_type); 149 164 sub->valid[i] = 1; 150 165 } … … 155 170 memset(sub->valid, 0, cache->nrows); 156 171 sub->row = i; 157 Rast_get_row(cache->fd, sub->buf[0], row, data_type);172 read_row(cache->fd, sub->buf[0], row, data_type); 158 173 sub->valid[0] = 1; 159 174 return sub->buf[0]; … … 183 198 G_freea(vtmp); 184 199 185 Rast_get_row(cache->fd, sub->buf[i], row, data_type);200 read_row(cache->fd, sub->buf[i], row, data_type); 186 201 sub->valid[i] = 1; 187 202 … … 366 381 } 367 382 368 static void read_row(int fd, void *buf, int row, int res_type)369 {370 Rast_get_row(fd, buf, row, res_type);371 }372 373 383 static void setup_map(struct map *m) 374 384 { … … 577 587 #ifdef HAVE_PTHREAD_H 578 588 pthread_mutex_init(&cats_mutex, NULL); 589 pthread_mutex_init(&mask_mutex, NULL); 590 masking = Rast_maskfd() >= 0; 579 591 #endif 580 592 … … 636 648 #ifdef HAVE_PTHREAD_H 637 649 pthread_mutex_destroy(&cats_mutex); 650 pthread_mutex_destroy(&mask_mutex); 638 651 #endif 639 652 }
Note:
See TracChangeset
for help on using the changeset viewer.
