VirtualBox

Changeset 90392 in vbox for trunk/src/VBox/Runtime/r3/posix


Ignore:
Timestamp:
Jul 29, 2021 8:25:50 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145978
Message:

IPRT/RTThreadCreate: Added RTTHREADFLAGS_NO_SIGNALS (posix only). bugref:6695

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp

    r89870 r90392  
    238238}
    239239
    240 static void rtThreadPosixBlockSignals(void)
    241 {
     240static void rtThreadPosixBlockSignals(PRTTHREADINT pThread)
     241{
     242    /*
     243     * Mask all signals, including the poke one, if requested.
     244     */
     245    if (   pThread
     246        && (pThread->fFlags & RTTHREADFLAGS_NO_SIGNALS))
     247    {
     248        sigset_t SigSet;
     249        sigfillset(&SigSet);
     250        int rc = sigprocmask(SIG_BLOCK, &SigSet, NULL);
     251        AssertMsg(rc == 0, ("rc=%Rrc errno=%d\n", RTErrConvertFromErrno(errno), errno)); RT_NOREF(rc);
     252    }
    242253    /*
    243254     * Block SIGALRM - required for timer-posix.cpp.
     
    245256     * It will not help much if someone creates threads directly using pthread_create. :/
    246257     */
    247     if (!RTR3InitIsUnobtrusive())
     258    else if (!RTR3InitIsUnobtrusive())
    248259    {
    249260        sigset_t SigSet;
     
    255266#ifdef RTTHREAD_POSIX_WITH_POKE
    256267    /*
    257      * bird 2020-10-28: Not entirely sure we do this, but it makes sure the signal works
     268     * bird 2020-10-28: Not entirely sure why we do this, but it makes sure the signal works
    258269     *                  on the new thread.  Probably some pre-NPTL linux reasons.
    259270     */
     
    286297    rtThreadPosixSelectPokeSignal();
    287298#endif
    288     rtThreadPosixBlockSignals();
     299    rtThreadPosixBlockSignals(NULL);
    289300}
    290301
     
    331342DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
    332343{
    333     rtThreadPosixBlockSignals();
     344    rtThreadPosixBlockSignals(pThread);
    334345
    335346    int rc = pthread_setspecific(g_SelfKey, pThread);
     
    367378#endif
    368379
    369     rtThreadPosixBlockSignals();
     380    rtThreadPosixBlockSignals(pThread);
    370381
    371382    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette