VirtualBox

Changeset 6961 in vbox


Ignore:
Timestamp:
Feb 14, 2008 5:39:02 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28130
Message:

Generic implementation (in case it's needed).

Location:
trunk/src/VBox/Runtime
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/thread.cpp

    r5999 r6961  
    547547{
    548548    Assert(pThread->cRefs >= 1);
     549
     550#ifdef IPRT_WITH_GENERIC_TLS
     551    /*
     552     * Destroy TLS entries.
     553     */
     554    rtThreadTlsDestruction(pThread);
     555#endif /* IPRT_WITH_GENERIC_TLS */
    549556
    550557    /*
     
    13191326#endif /* IN_RING3 */
    13201327
     1328
     1329#ifdef IPRT_WITH_GENERIC_TLS
     1330
     1331/**
     1332 * Thread enumerator - clears a TLS entry.
     1333 *
     1334 * @returns 0.
     1335 * @param   pNode   The thread node.
     1336 * @param   pvUser  The TLS index.
     1337 */
     1338static DECLCALLBACK(int) rtThreadClearTlsEntryCallback(PAVLPVNODECORE pNode, void *pvUser)
     1339{
     1340    PRTTHREADINT pThread = (PRTTHREADINT)pNode;
     1341    RTTLS iTls = (RTTLS)(uintptr_t)pvUser;
     1342    ASMAtomicWritePtr(&pThread->apvTlsEntries[iTls], NULL);
     1343    return 0;
     1344}
     1345
     1346
     1347/**
     1348 * Helper for the generic TLS implementation that clears a given TLS
     1349 * entry on all threads.
     1350 *
     1351 * @param   iTls        The TLS entry. (valid)
     1352 */
     1353void rtThreadClearTlsEntry(RTTLS iTls)
     1354{
     1355    RT_THREAD_LOCK_TMP(Tmp);
     1356    RT_THREAD_LOCK_RD(Tmp);
     1357    RTAvlPVDoWithAll(&g_ThreadTree, true /* fFromLeft*/, rtThreadClearTlsEntryCallback, (void *)(uintptr_t)iTls);
     1358    RT_THREAD_UNLOCK_RD(Tmp);
     1359}
     1360
     1361#endif /* IPRT_WITH_GENERIC_TLS */
     1362
  • trunk/src/VBox/Runtime/include/internal/thread.h

    r5999 r6961  
    7979/** Max thread name length. */
    8080#define RTTHREAD_NAME_LEN 16
     81#ifdef IPRT_WITH_GENERIC_TLS
     82/** The number of TLS entries for the generic implementation. */
     83# define RTTHREAD_TLS_ENTRIES 64
     84#endif
    8185
    8286/**
     
    133137    RTUINTPTR volatile      uBlockId;
    134138#endif /* IN_RING3 */
     139#ifdef IPRT_WITH_GENERIC_TLS
     140    /** The TLS entries for this thread. */
     141    void                   *apvTlsEntries[RTTHREAD_TLS_ENTRIES];
     142#endif
    135143    /** Thread name. */
    136144    char                    szName[RTTHREAD_NAME_LEN];
     
    222230int rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority);
    223231#endif /* !IN_RING0 */
     232#ifdef IPRT_WITH_GENERIC_TLS
     233void rtThreadClearTlsEntry(RTTLS iTls);
     234void rtThreadTlsDestruction(PRTTHREADINT pThread); /* in tls-generic.cpp */
     235#endif
    224236
    225237__END_DECLS
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