@@ -66,7 +66,7 @@ static int exit_pipe_fd;
6666
6767static renderd_config config ;
6868
69- int noSlaveRenders ;
69+ int num_slave_threads ;
7070
7171int foreground = 0 ;
7272
@@ -826,7 +826,7 @@ int main(int argc, char **argv)
826826 exit (1 );
827827 }
828828
829- noSlaveRenders = 0 ;
829+ num_slave_threads = 0 ;
830830
831831 int iconf = -1 ;
832832 char buffer [PATH_MAX ];
@@ -873,6 +873,10 @@ int main(int argc, char **argv)
873873 config_slaves [render_sec ].pid_filename = iniparser_getstring (ini ,
874874 buffer , (char * ) RENDERD_PIDFILE );
875875
876+ if (config_slaves [render_sec ].num_threads == -1 ) {
877+ config_slaves [render_sec ].num_threads = sysconf (_SC_NPROCESSORS_ONLN );
878+ }
879+
876880 if (render_sec == active_slave ) {
877881 config .socketname = config_slaves [render_sec ].socketname ;
878882 config .iphostname = config_slaves [render_sec ].iphostname ;
@@ -890,7 +894,7 @@ int main(int argc, char **argv)
890894 config .mapnik_font_dir_recurse = iniparser_getboolean (ini ,
891895 "mapnik:font_dir_recurse" , MAPNIK_FONTS_DIR_RECURSE );
892896 } else {
893- noSlaveRenders += config_slaves [render_sec ].num_threads ;
897+ num_slave_threads += config_slaves [render_sec ].num_threads ;
894898 }
895899 }
896900 }
@@ -1051,7 +1055,7 @@ int main(int argc, char **argv)
10511055 g_logger (G_LOG_LEVEL_INFO , "config renderd: num_threads=%d" , config .num_threads );
10521056
10531057 if (active_slave == 0 ) {
1054- g_logger (G_LOG_LEVEL_INFO , "config renderd: num_slaves =%d" , noSlaveRenders );
1058+ g_logger (G_LOG_LEVEL_INFO , "config renderd: num_slave_threads =%d" , num_slave_threads );
10551059 }
10561060
10571061 g_logger (G_LOG_LEVEL_INFO , "config renderd: tile_dir=%s" , config .tile_dir );
@@ -1165,7 +1169,7 @@ int main(int argc, char **argv)
11651169 //Only the master renderd opens connections to its slaves
11661170 k = 0 ;
11671171 slave_threads
1168- = (pthread_t * ) malloc (sizeof (pthread_t ) * noSlaveRenders );
1172+ = (pthread_t * ) malloc (sizeof (pthread_t ) * num_slave_threads );
11691173
11701174 for (i = 1 ; i < MAX_SLAVES ; i ++ ) {
11711175 for (j = 0 ; j < config_slaves [i ].num_threads ; j ++ ) {
0 commit comments