If threads is set to 0, try to autodetect number of threads.

This commit is contained in:
Dave Davenport 2015-11-12 17:20:51 +01:00
parent e6ca8acba9
commit 45c8de9387
3 changed files with 16 additions and 8 deletions

View file

@ -38,6 +38,7 @@ AS_IF([test "x$enable_i3support" != xno && test "x$enable_windowmode" != "xno"],
##
AC_CHECK_FUNC([getdelim],, AC_MSG_ERROR("Could not find getdelim in c library"))
AC_CHECK_FUNC([sysconf],, AC_MSG_ERROR("Could not find sysconf"))
##
# Check dependencies
##

View file

@ -33,14 +33,14 @@ typedef struct
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
} TextboxFlags;
typedef enum

View file

@ -513,6 +513,13 @@ void remove_pid_file ( int fd )
*/
void config_sanity_check ( Display *display )
{
if ( config.threads == 0 ) {
config.threads = 1;
long procs = sysconf ( _SC_NPROCESSORS_CONF );
if ( procs > 0 ) {
config.threads = MIN(procs,UINT_MAX);
}
}
// If alternative row is not set, copy the normal background color.
// Do this at the beginning as we might use it in the error dialog.
if ( config.menu_bg_alt == NULL ) {