VirtualBox

Changeset 19729 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
May 15, 2009 11:54:18 AM (16 years ago)
Author:
vboxsync
Message:

RTLogSetDefaultInstanceThread change; ring 0 logging fix for multiple VCPUs

File:
1 edited

Legend:

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

    r18188 r19729  
    14761476#ifdef IN_RING0
    14771477/**
    1478  * Changes the default logger instance for the current thread.
     1478 * Changes the default logger instance for the specified thread.
    14791479 *
    14801480 * @returns IPRT status code.
    1481  * @param   pLogger     The logger instance. Pass NULL for deregistration.
    1482  * @param   uKey        Associated key for cleanup purposes. If pLogger is NULL,
    1483  *                      all instances with this key will be deregistered. So in
    1484  *                      order to only deregister the instance associated with the
    1485  *                      current thread use 0.
    1486  */
    1487 RTDECL(int) RTLogSetDefaultInstanceThread(PRTLOGGER pLogger, uintptr_t uKey)
     1481 * @param   hNativeThread   Thread handle
     1482 * @param   pLogger         The logger instance. Pass NULL for deregistration.
     1483 * @param   uKey            Associated key for cleanup purposes. If pLogger is NULL,
     1484 *                          all instances with this key will be deregistered. So in
     1485 *                          order to only deregister the instance associated with the
     1486 *                          current thread use 0.
     1487 */
     1488RTDECL(int) RTLogSetDefaultInstanceThread(RTNATIVETHREAD hNativeThread, PRTLOGGER pLogger, uintptr_t uKey)
    14881489{
    14891490    int             rc;
    1490     RTNATIVETHREAD  Self = RTThreadNativeSelf();
    14911491    if (pLogger)
    14921492    {
     
    15011501        i = RT_ELEMENTS(g_aPerThreadLoggers);
    15021502        while (i-- > 0)
    1503             if (g_aPerThreadLoggers[i].NativeThread == Self)
     1503            if (g_aPerThreadLoggers[i].NativeThread == hNativeThread)
    15041504            {
    15051505                ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)uKey);
     
    15251525                AssertCompile(sizeof(RTNATIVETHREAD) == sizeof(void*));
    15261526                if (    g_aPerThreadLoggers[i].NativeThread == NIL_RTNATIVETHREAD
    1527                     &&  ASMAtomicCmpXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].NativeThread, (void *)Self, (void *)NIL_RTNATIVETHREAD))
     1527                    &&  ASMAtomicCmpXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].NativeThread, (void *)hNativeThread, (void *)NIL_RTNATIVETHREAD))
    15281528                {
    15291529                    ASMAtomicXchgPtr((void * volatile *)&g_aPerThreadLoggers[i].uKey, (void *)uKey);
     
    15441544        int32_t i = RT_ELEMENTS(g_aPerThreadLoggers);
    15451545        while (i-- > 0)
    1546             if (    g_aPerThreadLoggers[i].NativeThread == Self
     1546            if (    g_aPerThreadLoggers[i].NativeThread == hNativeThread
    15471547                ||  g_aPerThreadLoggers[i].uKey == uKey)
    15481548            {
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