Skip to content

多线程 ​

多线程的组件名称为 multithreading, 相关内核选项为

ini
# General setup
# -> Configure standard kernel features (expert users)
# -> Enable eventpoll support
CONFIG_EPOLL=y

# General setup
# -> Configure standard kernel features (expert users)
# -> Enable signalfd() system call
CONFIG_SIGNALFD=y

# General setup
# -> Configure standard kernel features (expert users)
# -> Enable timerfd() system call
CONFIG_TIMERFD=y

# General setup
# -> Configure standard kernel features (expert users)
# -> Enable eventfd() system call
CONFIG_EVENTFD=y

# General setup
# -> Configure standard kernel features (expert users)
# -> Enable futex support
CONFIG_FUTEX=y

检查工具为

bash
#!/bin/bash

source ./kernel_config_utils.sh

multithreading_check() {
    is_error=false
    if ! kernel_config_check CONFIG_EPOLL; then
        is_error=true
    fi
    if ! kernel_config_check CONFIG_SIGNALFD; then
        is_error=true
    fi
    if ! kernel_config_check CONFIG_TIMERFD; then
        is_error=true
    fi
    if ! kernel_config_check CONFIG_EVENTFD; then
        is_error=true
    fi
    if ! kernel_config_check CONFIG_FUTEX; then
        is_error=true
    fi
    if [ "$is_error" == "true" ]; then
        return 1
    fi

    return 0
}