이 페이지에서

스레드 지원

스레드 지원 명령어는 클래스나 함수에서 멀티스레드 프로그래밍에 대한 지원 수준을 지정하기 위한 것입니다. 지원 수준은 threadsafe, reentrant, nonreentrant 의 세 가지가 있습니다.

기본값은 ` nonreentrant `이며, 이는 해당 클래스나 함수가 여러 스레드에서 호출될 수 없음을 의미합니다. ` Reentrant ` 및 ` threadsafe `는 주로 클래스에 사용되는 수준입니다.

Reentrant 이는 참조된 클래스의 모든 함수가, 각 호출이 고유한 데이터를 참조하는 경우에만 여러 스레드에 의해 동시에 호출될 수 있음을 의미합니다. 반면 threadsafe 은 각 호출이 공유 데이터를 참조하는 경우라도 참조된 클래스의 모든 함수가 여러 스레드에 의해 동시에 호출될 수 있음을 의미합니다.

클래스에 \reentrant 또는 \threadsafenonreentrant 로 표시된 경우, 해당 클래스의 함수는 \nonreentrant 명령을 사용하여 해당 클래스의 함수들을 xml-ph-0000@deepl.internal로 표시할 수 있습니다.

예시

/*!
    \class QLocale
    \brief The QLocale class converts between numbers and their
    string representations in various languages.

    \reentrant
    \ingroup i18n
    \ingroup text

    QLocale is initialized with a language/country pair in its
    constructor and offers number-to-string and string-to-number
    conversion functions similar to those in QString.

    ...

    \nonreentrant

    Sets the global default locale to \a locale. These values are
    used when a QLocale object is constructed with no
    arguments. If this function is not called, the system's locale
    is used.

    \warning In a multithreaded application, the default locale
    should be set at application startup, before any non-GUI
    threads are created.

    \sa system(), c()
*/
void QLocale::setDefault(const QLocale &locale)
{
    default_d = locale.d;
}

QDoc은 클래스가 재진입 가능(reentrant)으로 선언되면 알림을 생성하고, 예외(선언된 비재진입 가능 함수)를 나열합니다. 재진입 가능성과 스레드 안전성에 대한 일반 문서 링크가 포함됩니다. 또한 재진입 불가능한 함수의 문서에는“경고: 이 함수는 재진입 불가능합니다.”라는경고 문구가 생성됩니다.

QDoc은 클래스가 스레드 안전(thread-safe)으로 선언되었을 때도 동일한 알림과 경고를 생성합니다.

자세한 내용은 재진입성 및 스레드 안전성에 관한 일반 문서를 참조하십시오.

명령어

\threadsafe

\threadsafe 명령어에는 관련 클래스나 함수가 스레드 안전하며, 별도의 호출에서 공유 데이터를 참조하는 경우에도 여러 스레드에서 동시에 호출될 수 있음을 나타내는 문구가 문서에 포함됩니다.

이 명령어는 반드시 별도의 줄에 작성되어야 합니다.

이 명령어로 생성된 문서는 \reentrant 명령어에 대해 생성된 문서와 유사합니다. 서론의 위 예시를 참조하십시오.

다음 항목도 참조하십시오 \reentrant 및 \nonreentrant를 참조하십시오.

\reentrant

\reentrant 명령어는 각 호출이 고유한 데이터를 참조한다는 전제 하에, 관련 클래스나 함수가 여러 스레드에 의해 동시에 호출될 수 있음을 나타냅니다. 위의 예제를 참조하십시오.

이 명령어는 별도의 줄에 작성해야 합니다.

참조 \nonreentrant 및 \threadsafe.

\nonreentrant

\nonreentrant 명령어는 해당 클래스나 함수가 여러 스레드에서 호출될 수 없음을 나타냅니다. Nonreentrant가 기본값입니다.

이 명령어는 별도의 줄에 작성해야 합니다.

클래스에 \reentrant 또는 \threadsafenonreentrant 로 표시된 경우, 해당 클래스의 함수들은 제외할 함수에 대한 \fn 제외할 함수의 주석에서 이 명령어를 사용하여 함수를 `xml-ph-0000@deepl.internal`로 표시할 수 있습니다.

참조: \reentrant 및 \threadsafe참조하십시오.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.