VirtualBox

Changeset 34256 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Nov 22, 2010 3:55:00 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68004
Message:

IPRT: Must clear the TLS entry holding RTTHREAD before freeing the structure or the electric fence heap may cause a crash when blocking.

Location:
trunk/src/VBox/Runtime/r3
Files:
3 edited

Legend:

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

    r33393 r34256  
    9595
    9696
     97void rtThreadNativeDestroy(PRTTHREADINT pThread)
     98{
     99    if (pThread == *g_ppCurThread)
     100        *g_ppCurThread = NULL;
     101}
     102
     103
    97104/**
    98105 * Wrapper which unpacks the params and calls thread function.
  • trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp

    r34176 r34256  
    204204
    205205
     206void rtThreadNativeDestroy(PRTTHREADINT pThread)
     207{
     208    if (pThread == (PRTTHREADINT)pthread_getspecific(g_SelfKey))
     209        pthread_setspecific(g_SelfKey, NULL);
     210}
     211
     212
    206213/**
    207214 * Wrapper which unpacks the params and calls thread function.
     
    243250    rc = rtThreadMain(pThread, (uintptr_t)Self, &pThread->szName[0]);
    244251
    245     pthread_setspecific(g_SelfKey, NULL);
    246252    pthread_exit((void *)rc);
    247253    return (void *)rc;
  • trunk/src/VBox/Runtime/r3/win/thread-win.cpp

    r32914 r34256  
    7878        TlsSetValue(g_dwSelfTLS, NULL);
    7979    }
     80}
     81
     82
     83void rtThreadNativeDestroy(PRTTHREADINT pThread)
     84{
     85    if (pThread == (PRTTHREADINT)TlsGetValue(g_dwSelfTLS))
     86        TlsSetValue(g_dwSelfTLS, NULL);
    8087}
    8188
Note: See TracChangeset for help on using the changeset viewer.

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